This topic contains 6 replies, has 0 voices, and was last updated by hemang 8 years, 1 month ago.

  • Author
    Posts
  • #9871

    Voltron

    I have a somewhat complex workflow. Requirements for a change to this workflow require Suitescript. I don’t like straddling solutions, so I intend to reproduce most of the workflow with script (the other parts of the workflow are not needed). Is there any way to view the code that was generated by the workflow engine? I’ve been able to extract such a thing from client-type workflows, but getting into the server-type pieces of a workflow seems more challenging.
    This is a cached copy. Click here to see the original post.

  • #9872

    david.smith

    You can initiate and trigger them with suitescript but not load. I’m not sure if you can do anything with suitetalk or not.

  • #9873

    Voltron

    Thanks, David. I think you understand my request, but I think an example will ensure you (and others) get it.

    Excerpt of a workflow might look like:

    Before Record Submit:

    — Set Field Value: Employee = Current User w/ condition: Type: Create

    I’d like to see the code this generated that might look like:

    function beforeSubmit(){

    var context = nlapiGetContext();

    if (type == ‘create’) nlapiSetFieldValue(’employee’,context.getUser());

    }

    Would be amazing if the workflow states and transitions were also represented.

  • #9874

    k_dunc

    I know of no utility in NetSuite that will show you code generated from a Workflow.

    Further, I note you said that you don’t like to ‘straddle solutions’, and I get that, but if you have a complex Workflow that clearly is working fine, but now requires some mods., I’d be suggesting the KISS methodology and looking to simply write the code required for your mod., and then have your Workflow call your script. Just sayin’.

    Cheers.

  • #9875

    chanarbon

    Hi Joshua,

    I would suggest you to use the SuiteFlow API, nlapiTriggerWorkflow(), to be specific to have the action triggered to lessen the time consumed to rebuilding the script from scratch.

    But yes, as of the moment, there is no direct way to converting workflow to scripts. Basically, every action like have their own SuiteScript function like Send Email function be nlapiSendEmail(). I guess, the naming conventions for the action would be helpful for to you find the SuiteScript function used. I guess the only tricky part is the the transitions but it is rather more on the use of operators, a couple of searches and a couple of get field values and lookup fields to do a workaround on it.

  • #9876

    hemang

    Hi Chanarbon

    How to make the transition possible through script. like for example, i have added button via suiteflow and if user logs in and clicks button on Bill, it will get approved since its approve button.

    now i am adding email capture plugin where in if user approves via email, then the bill should get approved via plugin. how to generate the click event of button via script.

  • #9877

    hemang

    Just found out that nlapiTriggerWorkflow can be used to transition. Thanks.

You must be logged in to reply to this topic.