How to get portal url in virtual agent script

kamer
Kilo Expert

Hi,

I have a requirement to get the portal URL in virtual agent script.Like i need to check weather its HR portal or IT Portal in greetings message topic.

1 ACCEPTED SOLUTION

Imam Pasha1
Giga Guru

Hi Kamer,

As per your details provided please try below code and let me know.Its working fine for me with below solution:Add this below code in greeting topic inside script action

(function execute() {
vaVars.greeting_message = vaSystem.getGreetingMessage();

if(!vaContext.portal){
returnfalse
}
elseif(vaContext.portal=='sp'){

return vaVars.LiveAgent_queue='d50bdb2fdb501010b45e9444ca96192a';

}
elseif(vaContext.portal=='esc'){
return vaVars.LiveAgent_queue='fde232209f22120047a2d126c42e70ab';

}

})()
 
Please mark as correct answer if its working for you.
 
Regards,
Imam Pasha

View solution in original post

8 REPLIES 8

So how are you addressing the Virtual Agent widget? How does the URL look like? Does that match "ITServices" or "hrportal"?

I assume you need this because you do mention something on the greeting message. If not, then you could also have a look at the "Service Portal Agent Chat Configurations".

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Imam Pasha1
Giga Guru

Hi Kamer,

As per your details provided please try below code and let me know.Its working fine for me with below solution:Add this below code in greeting topic inside script action

(function execute() {
vaVars.greeting_message = vaSystem.getGreetingMessage();

if(!vaContext.portal){
returnfalse
}
elseif(vaContext.portal=='sp'){

return vaVars.LiveAgent_queue='d50bdb2fdb501010b45e9444ca96192a';

}
elseif(vaContext.portal=='esc'){
return vaVars.LiveAgent_queue='fde232209f22120047a2d126c42e70ab';

}

})()
 
Please mark as correct answer if its working for you.
 
Regards,
Imam Pasha

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did this solve your question? Or do we need to follow-up on this?

Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did this solve your question? Or do we need to follow-up on this?

Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn