Display dynamic asset data (alm_asset) in ESC portal carousel per logged in user

singhpragati
Tera Contributor

I have a requirement to add a dynamic 5th slide in the ESC Portal Carousel. I need guidance on whether this is achievable and how to implement it.

 

CURRENT SETUP:
Our ESC Portal Carousel already has 4 static slides which are Announcement type records working perfectly.

NEW REQUIREMENT:
We need to add a 5th slide in the same carousel which should be dynamic - fetching data from the alm_asset table based on the logged-in user. Specifically:
 Check if the logged-in user has a Smart Phone assigned in alm_asset table
If the smart phone is retiring within the next 30 days, show a slide with:
* Asset Tag
* Model Name
* Retirement Date
* Number of days remaining
* A link to raise a new asset request(Catalog item)
- If no smart phone is retiring soon, this 5th slide should NOT appear
- Each user should see their own smart phone details (user-specific dynamic data)

 

CURRENT UNDERSTANDING:
The standard ESC Portal Carousel uses static Announcement records and supports basic user variables like ${user.first_name}. However, it does not seem to support dynamic database queries from tables like alm_asset.

We have already implemented this successfully as a separate Service Portal widget using gs.getUser().getID() in the server script to query alm_asset. But the requirement is specifically to show this as a slide within the existing Carousel.

 

 

QUESTIONS:
1. Is it possible to add a dynamic 5th slide in the existing ESC Portal Carousel that fetches data from alm_asset per logged-in user?
2. If yes, what is the recommended approach?
3. Is there any way to conditionally show/hide a carousel slide based on asset data?

 

Instance: ServiceNow ESC Portal
Table: alm_asset
Field: retired (retirement date)
Carousel: Currently has 4 static announcement slides

 

 

Any guidance or examples would be greatly appreciated!

Thank you!

1 ACCEPTED SOLUTION

lauri457
Tera Sage

You will need to specify what widgets you are working with. Are you using OOB widgets? Is it the carousel widget that uses [sp_carousel_slide] records or are you using content experiences?

View solution in original post

4 REPLIES 4

lauri457
Tera Sage

You will need to specify what widgets you are working with. Are you using OOB widgets? Is it the carousel widget that uses [sp_carousel_slide] records or are you using content experiences?

Hi @lauri457 , 
Thank You for your response.
We are using content experience widget for the carousel (not sp_carousel_slide records).
We currently have 4 static slides in content experiences and we want to add 5th dynamic slide that fetches data from alm_asset table based on logged in user to show smart phone EOL details if it is retiring within 30 days.
If the phone is not retiring in 30 days slides should NOT appear at all

Could you please suggest:
Is it possible to add dynamic user specific data as a slide in content experiences?
if yes what would be the recommended approach?

Thanks

With content experience you can only reference user tables like sys_user or hr profiles.

 

You can publish targeted content for audiences using user criteria: add a role to users that have an EOL device. You won't be able to do variable substitutions to other tables without customizing the related script includes in sn_cd scope

Hi @lauri457 
Thanks for response.
We are using content experience widget for the carousel
We currently have 4 static slides in content experiences and we want to add 5th dynamic slide if the logged in user has phone assigned in alm_asset table and it is retiring within next 30 days. If the phone is not retiring in next 30 days the slide should not appear at all. Each user has seen their own phone details only . 
Could you please suggest:
Is it possible to add dynamic user specific data as a slide in content experiences ?
If yes what would be the recommended approach?