Workflow Context and JavaScript

  • I am trying to create a workflow button where a user can provide needed information into appropriate fields.  The fields shown are based off of a "problem detail" field that was selected by the record creator.

    Example: bill_ProblemDetail = "ProblemA"

    Then, the screen created by the workflow button should show bill_FieldA and hide bill_FieldB

    I have been trying to use code in the Create Script of the field to achieve this:

    Code in Field A

    var strDetail = eWare.GetContextInfo("BillingLog", "bill_problemdetail");

        if (strDetail == 'ProblemA')

    However, this script always results in the object being hidden.  Testing of the script indicates that nothing is being passed to strDetail, always resulting in the condition being false.  I have tried replacing eWare.GetContextInfo() with Values(), but that doesn't work either.

    What is the correct way to pull context information while within a workflow?

    Any help would be greatly apprecaited; this one has been stumping me for weeks!


    - Matt -

  • What about setting up different rules for each problem detail type - this would mean you don't have to mess around with the field level scripts.

    For example on your workflow rule - Use the validate script so this rule only shows when the problem detail is ProblemA

    Valid = (bill_ProblemDetail == 'ProblemA');

    Then add just the fields that you want to that rule eg just bill_FieldA

    Then you can add another rule with another Validation script and just add the fields you want to that rule. I hope this is making sense! I'm pretty sure you can give your workflow rules the same name so that a user will always see 'Rule XYZ' but they won't know that it is a different rule depending on the values of the record.

  • I had thought of that.  Unfortunately, I have so many different sets of criteria, I would have to program at least 15 different buttons, possibly more, to achieve the desired results.  I was hoping for a more elegant solution...

    Thanks, though.

  • Just as a side note eWare.GetContextInfo() does not work with custom entities which is why strDetail was not getting populated. It only works on main entities such as Company, Person, Opportunity etc. This had me stumped for a while.