Update multiple tickets from UI Page

A Oliver
Kilo Explorer

Morning all,

I'm trying to update multiple tickets from a UI page. At present, for testing I'm just trying to add comments to multiple tickets with the click of one button, I think I can work out the rest from there of where I want to go with this. Just Jelly loses me.

So say for now the HTML portion is for now:

<g:ui_form>  

<input type="hidden" name="incident_id" value="TICKET1SYSID"/>  

<textarea id="comments" name="comments"></textarea>  

<g:dialog_buttons_ok_cancel ok="return true" />  

</g:ui_form>

<g:ui_form>

<input type="hidden" name="incident_id" value="TICKET2SYSID"/>  

<textarea id="comments" name="comments"></textarea>

<g:dialog_buttons_ok_cancel ok="return true" />

</g:ui_form>

Processing script example:

var inc = new GlideRecord('incident');  

inc.get(incident_id);  

inc.comments  = comments;  

inc.update();  

var urlOnStack = GlideSession.get().getStack().bottom();

response.sendRedirect(urlOnStack);

How do you split this out to be 1 button to save updates to all tickets.

For example, I want 1 UI page with multiple text inputs, that I'll have 1 button to save all - then it updates all of those tickets.

Hope this makes sense. Any pointers as to what to look at I'll much appreciate - google has me at a loss at present.

1 ACCEPTED SOLUTION

Hi



I modified your HTML a bit and dropped the jvar_i and its working in my end. In line



<g2:evaluate jelly="true">  


        var rec = new GlideRecord('planned_task');  


        rec.addQuery('active', true);  


        rec.addQuery('assigned_to', "X");  


        rec.query();  


        var count = 0;


</g2:evaluate>  




<j2:while test="$[rec.next()]">  


        <p>$[rec.number] </p>  


        <g2:evaluate>count++;</g2:evaluate>


        <input type="hidden" name="planned_$[count.toFixed()]" id="planned_$[count.toFixed()]" value="$[rec.getUniqueValue()]"/>  


        <textarea id="comments_$[count.toFixed()]" name="comments_$[count.toFixed()]"></textarea>    


</j2:while>  



<input type="hidden" name="rowCount" id="rowCount" value="$[rec.getRowCount()]"/>  


<g:ui_form><g:dialog_buttons_ok_cancel ok="return true" /></g:ui_form>



For some reason the "count" was printet as xxx.0 so thats the reason i added the "toFixed()" to it


View solution in original post

10 REPLIES 10

Thanks Lars. That's sorted that bit and the count is perfect now.



Bit odd though, suddenly it's erroring on the processing script side. Whereas before I could get the values from the HTML with the name - e.g. rowCount, comments etc. I get errors stating variables not defined.



EDIT:


Scratch that. Got it! Moving the while and hidden row count input into the <g:ui_form> tags did the job.



Thanks for your help Lars!