Send notification based on a variable response

Russell Park
Mega Guru

Hey guys!  I am working on a workflow and getting close to be completed.  I have a catalog item with about 8 variables.  I need to send a notification based on response to one of the variables.  If variables.type_of_request = CIP then send notification to specific email address.  I added the notification type to workflow but cant figure out how to only send based on the response to that variable.  Any help is appreciated!

 

1 ACCEPTED SOLUTION

Russell Park
Mega Guru
prabhmeet,
 
    You script has helped alot thanks.  I am running into one issue though.  Below is the code.
 
answer = ifScript();
function ifScript() {
if(current.variables.type_of_request == 'CIP' ){
return 'yes';
}
return 'no';
}
 
No matter if its CIP or NON-CIP it is still sending the notification.  It should only send email to the email address IF type of request == CIP.
 
What am i missing?
 
Thanks!

View solution in original post

8 REPLIES 8

HarshTimes
Tera Guru

1. Create a  new notification.

2. Select the table as sc_req_item.

3. In When to Send tab,In the condition builder first select show related fields . Now you will be able to select variables as a choice option there.

4.Then select the catalog item name and then the required variable name and then you will be able to select the options when you want to fire the notification.

5. Select the checkbox inserted only. 

6. In the next tab, who will receive, you will be able to select the user and in the next tab you will be able to set the body and subject of email.

 

Thanks

Harsh

 

 

Russell Park
Mega Guru

Harsh,

 

     I was trying to keep the notification with in the workflow process.  The option you are talking about is going through email - notifications.  Is this possible through the workflow "notifications" actions with scripting something like 

 

if ${variables.type_of_request}==CIP then sent to xxxxx@email.com??  

 

Im new to scripting so not sure exactly how to accomplish this.

Thanks for the help

Russell

prabhmeet
Giga Expert

Hi Russell,

What I did was in my requirement, I created an if condition in the workflow where you  can write your script -

answer = ifScript();

function ifScript() {

if(current.variables.type_of_request = CIP ){

return 'yes';

}

return 'no';

}

 Then you can select notification activity in workflow and mention the email in it.

Russell Park
Mega Guru
prabhmeet,
 
    You script has helped alot thanks.  I am running into one issue though.  Below is the code.
 
answer = ifScript();
function ifScript() {
if(current.variables.type_of_request == 'CIP' ){
return 'yes';
}
return 'no';
}
 
No matter if its CIP or NON-CIP it is still sending the notification.  It should only send email to the email address IF type of request == CIP.
 
What am i missing?
 
Thanks!