locked
Jscript code updates the owner of Opportunity does not trigger workflow why? RRS feed

  • Question

  •  

    How can I make the Jscript update the owner of opportunity and trigger the assign workflow?  I have the code in place now but it only triggers when i push the save button and workflow is being triggered twice

     

    Wednesday, May 14, 2008 5:32 PM

Answers

  • Devin,

    Can you post the trigger conditions for your Workflow?  Is it possible that you have marked it to trigger on "Record is assigned" and "Record attribute change" and have selected the Owner field?  How does your Javascript change the Owner, exactly?  Does it submit an Update/Assign operation through SOAP, or does it simply update the owner field's DataValue?


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Saturday, September 18, 2010 12:28 AM
    Moderator

All replies

  • Hi

    I'm giessing a bit here what it is you trying to do.

     

    Any changes made by Jscript is only saved to the CRM database if you click save.

    On my website you can see how to assign a value to a lookup field: http://www.dollerupit.dk/assigningdefaultvaluetolookup.aspx

    Is your script in the onLoad event? If so you'll see the same value over and over even if its not saved to the database if you don't just set the value if the crmForm.FormType == 1 (new form)

     

     

    /C

     

    www.dollerupit.dk

     

     

     

     

    Wednesday, May 14, 2008 8:48 PM
  • The script is on the onchange event on a drop down box

     

    The problem that I am having is that the owner is changing with the script but the workflow is working and when i push the save button it works but then it is sending out two emails?

     

    Usually when change the user of the opportunity the form refreshes or does something then the workflow is trigger but witht the code nothing is happening why how do i force it to trigger the workflow

     

    Wednesday, May 14, 2008 10:51 PM
  • I would suggest if you are using javascript to update the owner you simulate the save through javascript as well.

    crmform.save();

    • Proposed as answer by Amarsen Vangoor Friday, September 17, 2010 11:01 PM
    Friday, September 17, 2010 5:04 PM
  • you can invoke the workflow using javascript. Invoke your workflow in the Onchange event of your dropdown. Check the following post for more

    http://blogs.infinite-x.net/2007/06/15/launching-a-workflow-rule-from-javascript/


    Hope this helps. Amar
    Friday, September 17, 2010 11:12 PM
  • Devin,

    Can you post the trigger conditions for your Workflow?  Is it possible that you have marked it to trigger on "Record is assigned" and "Record attribute change" and have selected the Owner field?  How does your Javascript change the Owner, exactly?  Does it submit an Update/Assign operation through SOAP, or does it simply update the owner field's DataValue?


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Saturday, September 18, 2010 12:28 AM
    Moderator