service portal copy button

Ranjan_Pradhan
Tera Contributor

Hello all,

 

I am struggling with a requirement, where there should be a button on the portal called copy record on the form view of any opened record

 

For Eg: assume I have opened change record in portal, on the change form we should be able to see a button called copy change and it should take all the current values and should populate to a new change rec once clicked with out submitting (exactly how we have copy change in the instance)

I have the button on the form just struggling with the server code , please help me resolve this.

 

Thank You

 

 

 

 

 

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

There is an OOB UI action, which I think you can use to copy a change record.

If you want to build something similar, it should be something like

 

var myrec = new GlideRecord(current.sys_class_name);

myrec.newRecord();

myrec.field1 = current.field1;

myrec.field2 = current.field2;

var myrecsysid = myrec.insert();

myrec.get(myrecsysid);

action.setRedirectURL(myrec);

gs.addInfoMessage('Record has been cloned');


Please mark this response as correct or helpful if it assisted you with your question.

Ranjan_Pradhan
Tera Contributor

hello Sanjiv Meher 

 

myrec.newRecord(); this is redirecting me into the instance, the new from is not opening in the portal 

sp00789992
Tera Contributor

Hello Ranjan,

 

Did you get the solution for your question?

I have same kind of requirement? not able to use existing functionality of copy request and copy incident for EC or Service Portal.

 

Please share if you have any direction for the same.

 

Regards,

Sonali Pawar