Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Trigger workflow using a condition

kavyas
Kilo Explorer

Hi,

I want to trigger a workflow when an incident is created. I've tried to use if condition in the workflow as follows:

function ifScript() {

          if (previous.incident_state ==0 && current.incident_state==1) {

                return 'yes';

          }

        return 'no';

    }

Instead of having an if condition, I need to trigger the workflow when this condition is met.

Do I need to have a business rule to do such, else do we have any other option. Kindly suggest me the best approach to do it

Thank You.

2 REPLIES 2

Chuck Tomasi
Tera Patron

Hi Kavya,



Where are you trying to script that? Why not use the condition build in the workflow properties? It requires no script.



find_real_file.png


Gurpreet07
Mega Sage

previous will not be available when incident is inserted. Below should work.



function ifScript() {


if(current.incident_state==1) {


                return 'yes';


          }


        return 'no';


    }