The CreatorCon Call for Content is officially open! Get started here.

g_form.getParameter("sysparm_item_guid"); is not working on service portal

ArcRaj
Giga Contributor

Hi all,

g_form.getParameter("sysparm_item_guid"); is not working  on service portal  AND

g_form.getUniqueValue() is also not working

is there any alternate way.

 

 

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

in newyork its available , without writing a single code. 

 

find_real_file.png

 

Give a try. 

View solution in original post

13 REPLIES 13

what if i need the sys_id of that new record ?? i need it in my logic but 

 g_form.getElement('sysparm_item_guid').value; isn't work

Harsh Vardhan
Giga Patron

to make attachment mandatory , kindly have a look on below blog. it has mentioned the steps. 

 

HOW TO REQUIRE ATTACHMENTS IN SP

Harsh Vardhan
Giga Patron

in newyork its available , without writing a single code. 

 

find_real_file.png

 

Give a try. 

Hi harsha,

I tried the below code but it gives me the same alert even with or without attachment

 

 

/////client script////////

function onSubmit() {
//Type appropriate comment here, and begin script below
alert('in');
var cat_id=g_form.getUniqueValue();
//var cat_id= g_form.getParameter("sysparm_item_guid") ;
alert('id is '+cat_id);
var ga=new GlideAjax('MYSI');
ga.addParam('sysparm_name','Myfunction');
ga.addParam('sysparm_cat_id',cat_id);
ga.getXMLWait();
varc=ga.getAnswer();
if(c=="add attachment" )
{
alert(c);
return false;
}
else
{
alert("has attachment"+c);
return true;
}
}

 

//////script include////

var MYSI = Class.create();
MYSI.prototype = Object.extendsObject(AbstractAjaxProcessor, {
MYfunction(){
var cat_id=this.getParameter('sysparm_cat_id');
var gr=new GlideRecord('sys_attachment');
gr.addQuery('table_name','sc_req_item');
gr.addQuery('table_sys_id',cat_id);
//gr.addQuery("sys_created_on", '>=', 'javascript:gs.minutesAgo(10)');
gr.query();
if(!gr.next())
{
return "add attachment";
}
else
{
return "done";
}
},

type: 'MYSI'
});

the above code does not work for me

Portal settings section is not available on our personal project instance .I even tried to configure it but no use:(

 

thanks.

i am sorry, but you have tagged "NewYork" instance so "portal setting" should be available. 

if you wanna go with script , kindly have a look on below blog. it has mentioned different approach. 

 

https://www.servicenowelite.com/blog/2017/5/12/service-portal-require-attachments