Workflow Action - OnChange script -- Where stored in MetaData?

SUGGESTED

Help please!  I am looking for some scripts in a system in which parts of it are being migrated to another system.

I am trying to locate Create Script or OnChange Script populated on a workflow rules actions.

I believe I have located the values for Create Script...They appear to be located in the field WkAc_EmailBody.  Therefore, I need to confirm that is correct. 

However, I have not been able to determine where the OnChange Script is located.

Any assistance would be greatly appreciated.  

Thank you!!

  • 0

    Actually, I don't think I have located the Create Scripts either! :-(

    Therefore, I need assistance with both the Create Script and the OnChange script

    Thank you!

  • 0
    SUGGESTED

    Ok, the workflow tables are just plain weird.

    In the WorkflowActions table you will have 3 columns called WkAc_EmailTo, WkAc_EmailBCC, and WkAc_EmailBody. When you add a rule that isn't of type email, these fields do a different job. It's very poor in terms of design as you have a field that does multiple job which is just a database design "no no"

    Your create script lives in WkAc_EmailBCC

    Your on change script lives in WkAc_EmailBody

    Your validate script lives in WkAc_EmailTo

    Don't ask me why. The way to find out is to edit a standard workflow that you're not using, alter the script fields on a field and put in a comment like //create //onchange // validate and save and then query the tables looking for them. Hopefully I've saved you the job.

  • 0 in reply to Vega

    Does any of it get recorded if you create a component and script it out from there?

  • 0 in reply to Matthew Shaw
    SUGGESTED

    I think this is where Workflow is really weird again... unless Sage have resolved this. I haven't checked as I haven't done much in this area for a number of years. To script workflow to a component, you (certainly used to anyway) create a new component, then go to your workflow and script the workflow to the screen, then go back to your component and save it separately. The workflow is now in your component.

  • 0 in reply to Matthew Shaw

    I just now tested this and the answer is No, it doesn't.  I could be wrong but it sure seems like a bug.

    I created a  zzTemp workflow to test with.  I then edited the Lead workflow and opened the Lead Assigned user ID field.  I added Create, OnChange and Validate scripts and saved the field and the workflow Step.  When I tried to script the component, CRM gave this message:

         No data found. The zzTemp.ecf and zzTemp .es files has not been created.

    This is in 2020 R2.  The scripts for each field were:

         // testing
         1=1;

    Granted these script don't do anything to the record, but it's all valid javascript and the UI did save the changes, so it should be part of the component.  So again, could be wrong but it appears to be a bug.

  • 0 in reply to Graham MacLeod

    It's been 5 months now since last posting.  I've come across the issue again and wondering if anyone has any insights.  The main question is where does CRM store the Create, onChange and Validate scripts on a Workflow Action, e.g. Display Field for Amendment.  It's not in WorkflowActions nor in any of the "Custom_" metadata tables that I can see.

    Related concern is that workflow changes at this level are not recorded in Components.

    Thanks for any info you care to share.

  • 0 in reply to Graham MacLeod

    Looking at my demo CRM system it doubles up and uses fields on the WorklofwActions, for example Create scripts seem to be held in wkac_emailbcc not in a field of its own right

  • 0 in reply to Matthew Shaw

    Wow, Matthew, great catch!!  That's exactly right:

    • Validate() is in WkAc_EmailTo
    • Create() is in WkAc_EmailBCC
    • OnChange() is in WkAc_EmailBody

    That strikes me as a horrible design, for several reasons.  Also, as I look at the columns of the WorkflowActions table, I see that there's no WkAc_Component field, and so of course changes to Workflow Actions aren't included in a Component.  That's a really unfortunate design limitation.

    So mystery solved and again, thanks Matthew for sharing this insight.  It was right there all along, sheez!

  • 0 in reply to Graham MacLeod

    Graham:  So glad to see that this stumped the MASTER was well!  Lol!

    Hmmm..where does CRM store the validate, create and onchange scripts for a workflow action.  Oh, in fields with the word "Email" in them if it is not an email action.  Yep that makes sense!

    It does make me feel better that you were having trouble locating them as well.  Stuck out tongue winking eyeGrinRofl

  • 0 in reply to Michele Gaw

    I'm familiar with this messy idea from my days of working with GoldMine which was very badly designed - when new features were added over time rather than create new tables for the information, it just reused an existing table (e.g. 'Secondary contacts'). Got used to AddressLine1 being used for multiple purposes (e.g. AddressLine1 + AddressLine2 = Email address as well as Website and other purposes)

  • 0 in reply to Graham MacLeod

    I thought this is what I said in my reply to the initial question?

    As for getting workflow in a script, you need to do this manually but it is quite simple. The old way used to work, I'm sure of it, but it doesn't any more.

    Create a new component with the details you want. Make a small change like changing a field name and save. Then change it back and save again. Stop the component manager and script out the component. You will now have the ecf and es files. Open the es file in notepad and delete everything in it. Open the workflow you want to script and click on Preview List. Copy the text and paste it into the es file and save. You now have a component with the workflow in it.

  • 0 in reply to Vega

    Vega:  Thank you for this tip about recording a workflow component!  Very clever.

    Also, thank you for your initial response to my question.  I failed to respond back that it resolved my issue.

    I beilieve in the end, Graham realized the answer to his most recent question was in the original post.  Stuck out tongue winking eye

    Your assistance is greatly appreciated!

  • 0 in reply to Michele Gaw

    No worries. I hate how the workflow isn't scripted in a component but this was the only way I found that does what you need. I have in the past used a SQL script to pull out the records and recreate them in a new system. Essentially it was a stored procedure and the parameter was the workflow name and the target database. It went and did the rest. It was quite convoluted but it did recreate the workflow. I used the Sage stored procedures to create the record IDs so the integrity was maintained and it was successful. I ditched it once I found the workarounds to script the workflow. I no longer have the stored procedure either which is a shame as I do usually keep all the code I produce.