UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.

Line Item Creation - Insert Rows in Grid/Listing

Line Item Creation - Insert Rows in Grid/Listing

The information contained in this blog post provides a way to implement a solution for line items on invoices, expense report entries, time entries or other ideas you may have that would require a user to enter a list of items with multiple fields per entry.

 

One of the strengths of SBM is the ease of creating child or sibling records with references for the user to easily navigate between the relationships.  Without a good deal of customization, in the past, the best way to create these relationships was to use a “Post” transition, the user if presented with a form to enter the data for the new record, then click OK and they are able to view the original record as access the new record with a relational field or embedded report.  This can get a little tedious and require extra clicks when doing the above steps for creating an invoice with N number of line items.  See an example below.

https://youtu.be/Kb4BIhrPqOg

In the latest release of SBM, 11.2, we now have REST web services that can be leveraged to create new items.  The reason this is important is because we can now leverage the jQuery Ajax call to easily create the new child or sibling records without leaving the original form.  Perhaps the words don’t describe it best, so take a look at the video below for an example.

https://youtu.be/FwTZce9IgQs

By the way, this configuration already leverages SSO for user authentication to submit the new line item records.

For more information on the JSON API you can access the online documentation at:  http://help.serena.com or in the Composer Help.

If you are ready to implement this type of functionality I have included several documents in the zip file link to help you out.

  1. The blueprint I used to create the Invoice sample process in the videos above.  You will need SBM 11.2 to open the blueprint.
  2. 3 text files contain the JavaScripts included in my sample so you can copy/paste and do not have to retype everything.
  3. Step by Step Instruction document with screenshots.
  4. Instruction document on altering the jQuery Ajax call for use in your workflows.

 

Download Link:  LineItemCreation.zip

Labels (1)
Attachments

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Comments
Another very handy tip that I can't wait to implement.
This is great stuff, Erika!
Aw, my poor old URL-context-AppScript el cheapo API's are feeling 😞 about these latest developments. But I certainly won't miss the joy of parsing JSON text manually without the use of arrays, split, or regex's.
🙂
I don't see the blueprint in the zip file. Am I missing something? The only files I see are: 1. Ajaxjs.tx 2. CalculateTotalInvoicejs.txt 3. LineItemCalc_js.txt 4. LineItemEditAgax)js.docx 5. LineItemImplementation.docx
Hi Roger, My apologies. I just updated the download link. If it is not there, let me know and we will just do direct email. But hopefully I got it fixed for ya! :) Thank you! Erika
Thanks - it is there now. What if I want to use single-selection lists in the "invoice" record? Can I map the values from the primary project to the "invoice" record?
Hi Roger, Selection list values do get a little tricky here. If you have a selection field on the invoice that will be mapped to the entries, the same "GetFieldValue" into a string variable and then mapping to a text field in the transition option will work and set the value. However if you are mapping a selection list to a selection list some more intelligence is going to be needed in the script as the transition option in the JSON API is expecting integers not display values. Plus since the integers would be different if you are posting from one primary table to another, and the fact that those integers could be different between your dev and production environments there will be some additional work involved.
I was able to use a post-transition appscript in the second app to handle the selection list values. i created hidden text fields for the display values from the calling app and then convert them into the correct selection values in the second aop. Thanks again, Roger
very cool stuff indeed. But alas being on 10.1.5.2 this is REST API is not really an option for us...
😞

Hi  @emarwood  and other members,

As posted download link ( LineItemCreation.zip ) doesn't work anymore, I’ll appreciate if someone could help me to get this zip or particular files.

Thanks

Hi @rjensen , @jmalin , @jonesgf  and @dsheaffe 

Sorry to bother,  but just noticed that @emarwood  is absent member.

Does anyone of you still have above zip ( LineItemCreation.zip) or similar working example to share ?

Thanks in advance

Sorry @SaleO , I don't have a copy.  

Hello,

i have a copy, but i can't upload the zip-file in the editor.

Does anyone have any idea how I can upload the file?

Hi,

Unfortunately the user ids did not get aligned with the migration. Attached is the documentation. Let me know if you do not receive it.

Erika


Top Contributors
Version history
Revision #:
6 of 6
Last update:
‎2020-12-14 20:19
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.