Checking Opportunity Fields On Save Button in Workflow

CRM 6.2.i

We have MAS 200 integrated with with our CRM. So when they create a new opportunity, they click on the "New Quote" button (in the Quotes tab) or "New Order" in the Orders tab and MAS pops up to allow them to fill in the information. After they refresh CRM, The quote or order pops up and we're in business; they click on the workflow to advance the opportunity.

What I have been noticing is sometimes they advance the opportunity down the workflow prematurely. For example, they might accidentally advance the "Invoice" stage before the status of the order has been changed to "Complete." Another example is they advance to the "Quoted" stage before even creating a quote in MAS.

So I'm looking for a way to check to see if an existing quote or order exists when they advance the workflow (and prevent workflow advancing until a quote or order exists within the opportunity)?

And I'm looking for a way to prevent workflow progressing if a quote or order status has not been changed to "complete."

  • 0

    Against each rule you can set Javascript conditions. You could have it look at the associated orders/quotes and their stage, and hide the rule should they not meet the conditions you require.

  • 0

    Phew! You wouldn't happen to know any tutorials or posts on this site that could teach me how to do this or adapt code to do this?

  • 0

    Take a look at the function: -

    eWare.CreateQueryObj

    You could then create a count of how many orders/quotes are their with the correct status, then use an IF to set if the rule is valid or not based on the results of the count.

  • 0

    I recently added an Opportunity Validation check to a workflow for a custom entity. I added the Opportunity ID field (home_opportunityid) to the screen and added the following code to the validation script on that field:
    var strID = Values('home_opportunityid');
    var OppoRecord = CRM.FindRecord("Opportunity","oppo_OpportunityID=" + Values('home_opportunityid'));
    var strAmount = OppoRecord.oppo_forecast;
    if (strID == 'undefined')
    {
    var strRuleMessage = "An Opportunity is required to submit.";
    Valid=false;
    ErrorStr = strRuleMessage;
    }
    if (strID == null)
    {
    var strRuleMessage = "An Opportunity is required to submit.";
    Valid=false;
    ErrorStr = strRuleMessage;
    }
    if (strID == '')
    {
    var strRuleMessage = "An Opportunity is required to submit.";
    Valid=false;
    ErrorStr = strRuleMessage;
    }
    if(strAmount
    {
    Valid=false;
    var strRuleMessage = "This Opportunity has less than $1M in Assets. More than $1M in Assets are required to be approved.";
    ErrorStr = strRuleMessage;
    }
    This code ensures that a linked opportunity has been added. It also checks the forecast amount to ensure that it meets certain criteria. You should be able to change the field being checked to validate your Opportunity. You might be able to leverage the code for checking Quotes, as well.
    Hopefully this will help!
    - Matt -