Have to view Excel document in next tab instead of downloading in incident form

Deepu9997
Tera Contributor

I had a List field in incident form in which when I click preview record it was downloading I need to view in the next tab.

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@Deepu9997 

Out of the box it opens up the record which is being referred there.

What's the business requirement to have list field referring to sys_attachment?

Since you are referring to sys_attachment and hence it's showing that Open Record.

What's the business use-case to allow downloading?

you will have to use UI macro and add that on that field using field attributes

This will involve lot of customizations.

Why not show the users related list of Sys attachment and when they click on it, it will download the file?

TNT: "Related Attachments" Related List 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Deepu9997 

Did my above post answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Deepu9997 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Deepu9997
Tera Contributor

can we make refresh token which works for 365 days

 

Deepu9997
Tera Contributor

(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {

// implement resource here

try {
var r = new sn_ws.RESTMessageV2();
r.setHttpMethod("post");
r.setEndpoint("https://hiltondev.service-now.com/oauth_token.do");

// Set headers
r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

// Prepare body
var payload = "grant_type=password" +
"&client_id=" + encodeURIComponent(gs.getProperty("Refresh_Token_Client_ID"))+
"&client_secret=" + encodeURIComponent(gs.getProperty("Refresh_Token_Client_Secret")) +
"&username=" + encodeURIComponent(gs.getProperty("Refresh_Token_Client_User_Name")) +
"&password=" + encodeURIComponent(gs.getProperty("Refresh_Token_Client_User_Password"));

r.setRequestBody(payload);

var res = r.execute();
var responseBody = res.getBody();
var httpStatus = res.getStatusCode();

response.setStatus(httpStatus);
response.setHeader("Content-Type", "application/json");

response.setBody({
status: httpStatus === 200 ? "success" : "failed",
http_status: httpStatus,
body: JSON.parse(responseBody)
});
a
} catch (ex) {
gs.error("OAuth Token Error: " + ex.message);

response.setStatus(500);
response.setHeader("Content-Type", "application/json");
response.setBody({
status: "failure",
error: ex.message
});
}
})(request, response);  fix the code