Get the right sys_id for screen in mobile view

rauhut
Tera Contributor

Hi,

 

I'm trying to set up mobil push notifications for new published news articles. It works so far but the push notification doesn't get the right deep link to the news content view in the Now Mobile App. 

 

Does somebody know which screen (sys_id) I have to take from sys_sg_screen.list that I can use to create the right deep link in the Push Notification Message Content? 

 

var formScreenSysId = "<here I need the right sys_id>";

var link = deepLinkGenerator.getFormScreenLink(
formScreenSysId,
current.getTableName(),
current.getValue("sys_id")
);
1 ACCEPTED SOLUTION

rauhut
Tera Contributor

Thanks for your answers and support. It took me a while to solve this issue or to find a workaround. 

 

I solved it with a Mobile Web Screen and a URL to the MESP portal page. Here is the script in my "Push Notification Message Content":

(function buildJSON(/*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {

    var deepLinkGenerator = new global.MobileDeepLinkGenerator("Request");
    var baseUrl = gs.getProperty("glide.servlet.uri");
    var articleUrl = baseUrl + "mesp?id=cd_news_article&view=mobile&sys_id=" + current.getUniqueValue();
    var link = deepLinkGenerator.getUniversalLink(articleUrl);

    var articleTitle = current.getDisplayValue("title") || current.getDisplayValue() || "News";

    return {
        "Link": link,
        "android_title": articleTitle,
        "aps": {
            "alert": {
                "title": articleTitle,
                "body": message || "New content"
            }
        }
    };

})(current, message, attributes);

 

View solution in original post

4 REPLIES 4

pr8172510
Mega Guru

Hi,

This can be a bit tricky — the key point is that the screen sys_id must match the exact mobile screen configuration used to render that record in Now Mobile, not just any screen from sys_sg_screen.


How to find the correct screen sys_id

1. Identify the actual mobile screen used

Go to:

  • Mobile App Builder → Your app (Now Mobile / Agent / custom)
  • Open the navigation/tab where News is displayed

Look for:

  • The screen configured for viewing the record (often something like Record, Form, or a custom screen)

2. Check screen configuration

Once you find the screen:

  • Open it
  • Copy its sys_id (this is what you need for getFormScreenLink())

Important:

  • It must be the screen tied to the table of your news articles (e.g., kb_knowledge or your custom table)

3. Verify from sys_sg_screen

If you’re searching via list:

  • Go to sys_sg_screen.list
  • Filter by:
    • App = your mobile app
    • Table = your article table

This helps narrow down the correct screen.


Common issue

Many people pick:

  • A generic screen
  • Or a screen from a different app

Result → deep link opens app but not the record


Quick validation tip

Test your sys_id by:

  • Hardcoding it
  • Sending a test push
  • If it opens the correct record → you’ve got the right one

Sanjay191
Kilo Patron

Hi @rauhut 

If you want to generate the deeplink then you need to pass the sys_id of the Record screen of the mobile where all the new content view shows. 

please check the below thread, i hope this will work for you 

https://www.servicenow.com/community/itsm-forum/not-able-to-redirect-to-request-record-incident-on-m...

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You!!





Hi @rauhut 
I hope this solution will work for you please close this thread if you get you solution for the future readers.

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You!!

rauhut
Tera Contributor

Thanks for your answers and support. It took me a while to solve this issue or to find a workaround. 

 

I solved it with a Mobile Web Screen and a URL to the MESP portal page. Here is the script in my "Push Notification Message Content":

(function buildJSON(/*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {

    var deepLinkGenerator = new global.MobileDeepLinkGenerator("Request");
    var baseUrl = gs.getProperty("glide.servlet.uri");
    var articleUrl = baseUrl + "mesp?id=cd_news_article&view=mobile&sys_id=" + current.getUniqueValue();
    var link = deepLinkGenerator.getUniversalLink(articleUrl);

    var articleTitle = current.getDisplayValue("title") || current.getDisplayValue() || "News";

    return {
        "Link": link,
        "android_title": articleTitle,
        "aps": {
            "alert": {
                "title": articleTitle,
                "body": message || "New content"
            }
        }
    };

})(current, message, attributes);