How to call Script Include from CLIENT EMAIL template?

cspra
Giga Expert

I would like to populate the REPLY TO, FROM or CC on Client Email template from the value return by the Script Include.

Is there anything wrong with my script/setup?  Thanks.find_real_file.pngfind_real_file.pngfind_real_file.png

 

1 ACCEPTED SOLUTION

Sandeep Kumar6
Giga Guru

Hi cspra,

 

Using Script Include to dynamically populate to or from is right only.

you can check the client callable checkbox in Script Include and try , It would work.

Below code use can use to auto populate current user nad its mail id in "to" or "from".

javascript:gs.getUserDisplayName()+" <"+ gs.getUser().getEmail()+">"

for reference :

https://community.servicenow.com/community?id=community_question&sys_id=94a60365db1cdbc01dcaf3231f96192d

 

Please Hit correct if this gave your answer.

Regards

Sandeep

 

 

View solution in original post

4 REPLIES 4

Sandeep Kumar6
Giga Guru

Hi cspra,

 

Using Script Include to dynamically populate to or from is right only.

you can check the client callable checkbox in Script Include and try , It would work.

Below code use can use to auto populate current user nad its mail id in "to" or "from".

javascript:gs.getUserDisplayName()+" <"+ gs.getUser().getEmail()+">"

for reference :

https://community.servicenow.com/community?id=community_question&sys_id=94a60365db1cdbc01dcaf3231f96192d

 

Please Hit correct if this gave your answer.

Regards

Sandeep

 

 

It works.  Thanks.

 

 

welcome:) way to go !!

Follow-up question - 

Do you see anything wrong here? 

javascript: new global.pru_hsrd_poc().build(current.assignment_group);

With the above code, it doesn't return anything from Script Include.  However, if the parameter is string instead of current.assignment_group, the call is working fine.  I am applying this to FROM field.

Here's my Script Include 

var pru_hsrd_poc = Class.create();
pru_hsrd_poc.prototype = {
initialize: function() {
},
build: function(xy) {
   return xy;
}
},
type: 'pru_hsrd_poc'
};