how can i update current object in UI page?

IamAmolB
Tera Guru

Hi Experts,

I have created a UI page where i am offering 3 operations like

1. save (like save & continue)

2. Exit (move to home page)

3. cancel (as OOB featured)

to make a save button enable i need current object to do the update (like current.update)

do we have any solution for this as i am not able to use current object in processing script any alternative?

how can i update the record on save button click of UI page.

Regards,

Amol Bavaskar

9405444404

1 ACCEPTED SOLUTION

IamAmolB
Tera Guru

Hi All,



I was wanted to update the form on button click on UI page (which is custom button ) for that we can have a method g_form.submit(); It should be written on client side and it will fulfill my updating requirement.



Thank you all for participating and replying me so quickly to answer.




Regards,


Amol Bavaskar


View solution in original post

9 REPLIES 9

Hi Amol,



If you are using a GlideRecord in a client-script (yes, there is a different version used client-side), it does not have an update() method.   I believe it can only be used to Query, Insert, or Delete records.



To update, you'll need to use a server-side script instead.




-Brian


Hi Brian,



we can do g_form.submit()


instead of update call in UI page.




Regards,


Amol


IamAmolB
Tera Guru

Hi All,



I was wanted to update the form on button click on UI page (which is custom button ) for that we can have a method g_form.submit(); It should be written on client side and it will fulfill my updating requirement.



Thank you all for participating and replying me so quickly to answer.




Regards,


Amol Bavaskar


Hi amolbavaskar,



I'm not sure if you resolved your issue as your last post was marked "Correct Answer" and I do not see the answer. If you want a record to be updated when you click "Submit" on your UI Page, you will need to put in place some additional code to allow this. For example:


1. Client Script function (g_form.submit() will not exist on a UI Page so you'll need to define your own function, and update the onclick attribute from your "button" element to call it.


2. The client script function will need to get the updated values (assuming these would be input elements on the page), and then send them back to the server (this could be done via GlideAjax or REST API etc).


3. The server would update the record. If using the REST API then you can use the Table API, and you don't need to add any server side code). If you are using GlideAjax, you will need to defined a client callable Script Include which has a function defined to take the values from the form and (1) get the record as a GlideRecord Object and (2) update the fields with the values sent from the client.



Please note that the above solution does not technically require the form to be submitted (posted). However, you could do a form post and use the UI Page processing script, or a separate Processor script to handle the next stage (e.g. record update).



Regards,


Jake


Thanks jake.gillespie you gave the exact answer what i have implemented.



Regards,


Amol