CRM Workflow JavaScript

This question is not answered
Trying to stop a rule from being accessible more than once so tried a rule similar to this however it doesn't seem to 
show the rule at any point.
var
LeadId = CRM.GetContextInfo("Opportunity","Oppo_LeadId"); if(LeadId == "2"){ Hidden = false; } else { Hidden = true; }

Leadid = 1 when the opportunity is first created and when the "Lead" rule is pressed, i have set leadid
to become 2 which should then stop the rule from showing up again, however it never seems to show...
Anyone have any ideas on this? Thanks!
All Replies
  • Your script appears to make Hidden = true for all values of LeadId except "2", ie the reverse to what you want.

    Try:

    Hidden = (LeadId == "2");  //assuming LeadId is a string - remove the quotes if it's a number

    Paul Cowper
    Marda Associates Ltd

    S-Link: Sage 50 Integration for Sage CRM.

    FormPop: Launch any Sage 200 forms from any Sage CRM page.

    Contract programming, development and implementation - Sage 50 (UK version), 200, 300 and CRM.  Prompt, confidential service.

  • Thanks for your help but it didn't seem to work...

    var oppoStage = CRM.GetContextInfo("Opportunity", "oppo_Ordered");

    if (oppo_Ordered == "Yes")

    {Hidden = true};

    else

    {Hidden = false};

    This is the current code i am using but cannot understand why it will not work. any ideas? thank you.

  • In the first line you define a var oppoStage and set it's value to Opportunity.oppo_Ordered.

    In the next line you test an unknown variable for value "Yes".

    I think you need to replace "oppo_Ordered" in line 2 with  "oppoStage".  Again, you can compress all the if() {} else {} stuff to:

    Hidden = (oppoStage == "Yes");

    Paul Cowper
    Marda Associates Ltd

    S-Link: Sage 50 Integration for Sage CRM.

    FormPop: Launch any Sage 200 forms from any Sage CRM page.

    Contract programming, development and implementation - Sage 50 (UK version), 200, 300 and CRM.  Prompt, confidential service.

  • Am I missing something here, are you not using Transitional Rules? So if you build the workflow to flow Stage A -> Stage B -> Stage C, going from B to C you wouldn't see the Rule found at A

  • Here is one resource that can help in solving your problem related to workflow app setting immediately dynamics.folio3.com/dynamics-ax-workflow-approvals-app