CopyRichText only working in some fields after library move - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

CopyRichText only working in some fields after library move

Last post 11-23-2015 05:56 PM by MitchH. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 10-05-2015 10:11 PM

    • MitchH
    • Not Ranked
    • Joined on 09-30-2014
    • Posts 8

    CopyRichText only working in some fields after library move

    Hi InfoPathDev folks,

    I have a health and safety form on our SharePoint site which uses qRules' CopyRichText function to copy safety precautions from a health and safety (HSE) knowledgebase which is a standard SharePoint list. We need to use CopyRichText as most of the knowledgebase results contain hyperlinks to further information.

    The form and qRules had all been working 100%, until some factors in play at my institution saw my site collection moved to a new location in SharePoint and the name of the HSE knowledgebase changed. After reworking my formulas to reference the new name of the HSE knowledgebase some instances of qRules work, while others do not. There are differences between the ones that work and the ones that don't, but both worked fine before the name change - strangest of all, everything works in preview mode in InfoPath.

    The form interacts with the knowledgebase in four places:


    1. On form load, using qRules finishedLoading, a set of general safety precautions is copied from the HSE knowledgebase to the form's general safety precautions field. This works, using this code:

    CopyRichText /dsnamesrc=HSE knowledge base /xpathsrc=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Controls[../d:Title ='General Precautions'] /xpathdest=/my:AssessmentDetails/my:GeneralSafety


    2. The form has a repeating section for users to add specific risk events. A drop-down box within the repeating section is populated from the titles of the entries in the HSE knowledgebase. The population works.


    3. When a user selects a risk type from the drop-down, three things should happen, but only one does:

    3a. The title of the risk type should be copied from the HSE knowledgebase to the title field of the repeating section. This does not work. The code looks like (and is underlined in InfoPath):

    concat("CopyRichText /dsnamesrc=HSE knowledge base /xpathsrc=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title[../d:Title ='", ., "'] /xpathdest=/my:AssessmentDetails/my:RiskAssessment/my:Risk_Assessment[", count(preceding-sibling::Risk_Assessment) + 1, "]/my:RiskItem")

    3b. The control measures for that particular risk should be copied from the HSE knowledgebase to the control measures section of the repeating section. This does not work. The code looks like (and is underlined in InfoPath):

    concat("CopyRichText /dsnamesrc=HSE knowledge base /xpathsrc=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Controls[../d:Title ='", ., "'] /xpathdest=/my:AssessmentDetails/my:RiskAssessment/my:Risk_Assessment[", count(preceding-sibling::Risk_Assessment) + 1, "]/my:RiskControl")

    3c. The risk level sets a drop-down box to the risk level associated with that risk type in the HSE knowledgebase. This works.


    I created a new form library and made my risk form template the default content type for the library and the issue persists there. I've been banging my head against this problem for a few days now and I can't seem to crack it. Do any of you wizards here have any thoughts?

    Thanks!
  • 10-05-2015 11:18 PM In reply to

    • MitchH
    • Not Ranked
    • Joined on 09-30-2014
    • Posts 8

    Re: CopyRichText only working in some fields after library move

    Ugh, I think the problem may be that I didn't update the data connection file in SharePoint when the HSE knowledgebase was renamed. I'm waiting for the farm admins to update a new copy of my form with the data connection updated appropriately.

    Would that cause the issues I'm seeing?
  • 10-06-2015 07:22 AM In reply to

    Re: CopyRichText only working in some fields after library move

     Do you have the qRules error node somewhere you can see it, maybe in a debug view? Any errors? Can you test this form in preview mode, without waiting for it to be published?

     

    Hilary Stoupa

  • 10-06-2015 04:15 PM In reply to

    • MitchH
    • Not Ranked
    • Joined on 09-30-2014
    • Posts 8

    Re: CopyRichText only working in some fields after library move

    Hah - this gets crazier and crazier.

    The farm admins updated my form template early this morning (time zone differences should make this a long-winded conversation) and now everything that *had* been broken is working, while the step on form load now doesn't do anything.

    Which preview mode do you mean? In InfoPath preview everything works - it's only when the form is published that components stop working. :/
  • 10-06-2015 06:15 PM In reply to

    Re: CopyRichText only working in some fields after library move

    Well, there is only one preview I know of in IP - when you are working on the form in design and preview it. And since everything works in preview, it sounds like the issue is in the browser. Do you have Form Load rules that execute qRules commands? If so, move those to the Qdabra Rules "finishedLoading" node - with the condition "finishedLoading is equal to true". Because in InfoPath rules run before code, we added the finishedLoading node to ensure qRules code is fully loaded prior to executing commands.
    Hilary Stoupa

  • 10-06-2015 10:46 PM In reply to

    • MitchH
    • Not Ranked
    • Joined on 09-30-2014
    • Posts 8

    Re: CopyRichText only working in some fields after library move

    Hey Hilary,

    First up, thanks for the responses so far!

    Everything works 100% in Infopath preview. I'd mentioned that in my first post - but I realize it was a long-winded post. :)

    I am using finishedLoading for a single CopyRichText, and that had been working but stopped working once I corrected the data connection to fix the other two CopyRichText actions! I'm going to delete and recreate the rule that queries the data source on form load to see if that makes a difference, but do let me know if there's anything else I should be checking.
  • 10-07-2015 07:35 AM In reply to

    Re: CopyRichText only working in some fields after library move

    Yup, I missed that! What version of qRules are you using? I see your first post is tagged 3.2 - is that the version you have? In later versions we added an execution history that tracks commands and errors for a session - I'm wondering if in the browser any error is reported in the Error node for the command.
    Hilary Stoupa

  • 10-07-2015 07:04 PM In reply to

    • MitchH
    • Not Ranked
    • Joined on 09-30-2014
    • Posts 8

    Re: CopyRichText only working in some fields after library move

    Hi Hilary,

    When I was adding tags, as soon as I started typing 'qrules' the website auto-completed the tag and added 3.2 (and wouldn't let me delete it).

    When I fire up the injector, it tells me it's version 6.1.5452.2783
  • 10-08-2015 07:33 AM In reply to

    Re: CopyRichText only working in some fields after library move

    Can you put the Execution History group from the Qdabra Rules data source someplace on your form and see if there are any errors when you try the form in the browser?
    Hilary Stoupa

  • 11-23-2015 05:56 PM In reply to

    • MitchH
    • Not Ranked
    • Joined on 09-30-2014
    • Posts 8

    Re: CopyRichText only working in some fields after library move

    Hi Hilary, Apologies for the long delay in getting back to you - a long stint of leave from work snuck up on me! At any rate, I had to make some other changes to the form, and once republished everything started working again. I didn't touch any of the qRules code in this latest version, so we'll just have to chalk this up to some sort of glitch in publishing the template. Thanks for all your assistance.
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.