You are on page 1of 4

Sriman Bonagiri

Puzzle question : If you have a 5-litre jug and a 3-litre jug and there is
unlimited amount of water , how would you measure exactly 4 litres?
POur 5 ltr 2 times and remove 3 ltrs 2 times then exactly 4 ltrs remains.
write a script to get HTTP status code in Rest message.

var request = new sn_ws.RESTMessageV2();


request.setEndpoint('https://dev119861.service-now.com/api/now/table/sys_user');
request.setHttpMethod('POST');

//Eg. UserName="admin", Password="admin" for this code sample.


var user = 'admin';
var password = 'Admin@123';
request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");
request.setRequestHeader('Content-Type','application/json');
request.setRequestBody('{"phone":"299-999-9991"}');
gs.info(request);
var response = request.execute();
var httpStatus = response.getStatusCode();
gs.info(httpStatus);

Write a code to insert 100 user data from Excel into table using array /hashtable?
In transform maps, use transform script, onbefore type
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if(source.sys_import_row >= 1000){
error = true;
})(source, map, log, target);

scenario based question for doing glideRecord.


Limit no. of records- gr.setLimit(5);
Active records- addActiveQuery(), etc

Nilesh Dilip Choure

write code to check whether numbr is prime or not?


write function to return count of duplicate records in a array?
"Acl related questions? like acl execution order and
differnce between table.none and table.*"
Difference between gliderecord and gliderecord secure?
can we use gliderecord query in acl script?
what is dictionary override?
what is dictinary attributes and name few?

Allow public
Allow tables
Autocomplete
Enable barcode scanner
Critical
Enable current location input helper
Dashboard filter
Encode UTF8
Exclude from rollback
Exclude Auto Recovery
Field decorations
how to write glide ajax?
how to use extended script include in server side say in business rule?

//same application scope


var ourExample = new ScriptIncludeName(params).functionName(params);

//cross application scope


var ourExample = new
ApplicationScope.ScriptIncludeName(params).functionName(params);

Shrey Joshi

"Three fields are there A,B,C on form C need to have sum of number in A,B,how can
this be achieved?
"
"in a 5*5 matrix ...which had elements either 3 or 4..write a function to return
row number in which 4 comes at the earliest ?Say in first row first 4 comes at 3rd
index and in second row in 2nd index and so on for all 5 rows .. eg[ [3,3,4,3,4],
[3,4,4,3,4] ,[4,3,3,4,3],[3,4,4,3,3],[3,3,3,3,4] ]
Row index
1. 3
2. 2
3. 1
4. 2
5. 5
Desired output should be row number 3"

Calculate the time and space complexity of the function I wrote for the function i
wrote?
Can I reduce the time complexity and space complexity of my script and how?
Question related to stack and queue? Like difference and usage of both
write any program using stack data structure?
Given an array in how many ways we can search for a elements? And time complexit y
of each method
Types of Sorting Algorithm and there time complexity. Which Algorithm does inbuilt
Javascript sort method is based on and what is its time complexity?

const array = [10, 11, 3, 20, 5];

const greaterThanTen = array.filter(element => element > 10);

console.log(greaterThanTen)
Filter
Find
Includes
IndexOf

var a=[ [3,3,4,3,4], [3,4,4,3,4] ,[4,3,3,4,3],[3,4,4,3,3],[3,3,3,3,4] ];


var n=4,c=0;
for(var i=0;i<a.length;i++){
for(var j=0;j<a.length;j++){
if(a[j][i]==n){
gs.info("element is found at row " + j + " and at column "+i);
c++;
if(c)
i=a.length;
}
}
}

Questions related to projects I have done ( in my case it is integration of snow


with sprinkler)
Outh 2.0 flow
Why outh 2.0 should be used instead of basic auth ?
What all details are required from third party for outh 2.0(like client id and
all)?
"Write a function to state whether string is valid or not
Given a string say 'abcabc'
The string is valid if count of each unique element is equal say in this case
a:2 times
b:2 times
c:2 times
So the given string is valid
Now say given string is ''abcabca""
a:3 times
b:2 times
c:2 times
So given string is not valid"
Write a function to give count of incidents based on category and also return
incident numbers?
Can we do asynchronous call in ui action script ? If yes how can we do
what are the ways to do asynchronous call?

REST
Why does my REST request return No matching API?
This means that the request URI doesn't match any of the supported APIs.
Check the APIs page (REST > APIs) to get valid URIs.
Also note that all REST APIs are relative to /api, so your URI must look like:
https://<instance.service-now.com>/api/.

I don't want to get responses on POST, PUT, or PATCH operations. Is there a way to
suppress them?

Yes, use the X-No-Response-Body header to suppress responses.

How is the REST API different from the existing JSONv2?

There are several differences. For starters, REST supports XML.


The REST API works on HTTP methods and follows REST best practices more closely,
with proper headers and response status codes. There are more differences under
the hood with respect to implementation and performance.

Will sending lots of REST requests with an authorization header may create sessions
every time?
How can I overcome this?

Yes, sending authentication information every time will create a session.


Instead, handling cookies properly in your client code will bind requests to
existing user sessions.

What are the different security measures for REST?


All REST requests are authenticated using Basic Auth.
To allow unauthenticated access, set glide property glide.basicauth.required.api to
false.
This will allow unauthenticated access to REST API.
The REST API is secured using a user role called rest_service.
Set this to inactive to allow access to the REST API for all users.
Starting in Geneva, the rest_service role is no longer required to access the REST
API.
All tables are protected by ACLs defined on them. The REST API won't skip any of
the ACLs defined on tables.

Is there mutual auth support for REST?


No. Mutual authentication is available only for outbound REST.
Inbound requests to a ServiceNow REST API do not support mutual auth.

wap to get categories with names...

var gr = new GlideAggregate('incident');


gr.addAggregate('COUNT','category');
gr.query();
gs.info("TOTAL CATEGORIES IS "+gr.getRowCount('COUNT'));
while(gr.next()){
gs.info(gr.getValue('category'));
}

You might also like