Updating a custom fields value on inventory  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Updating a custom fields value on inventory

Postby SBarnes » Thu Mar 04, 2021 11:14 am

I need to update a custom field value on the inventory item to the database without updating the inventory item i.e. I don't want the last saved date and time to update, will the following work where jinv is the business object?

Code: Select all
 jinv.CustomFieldValues.get_ItemFromSettingName("FieldName").Save(jinv.InventoryID);
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Updating a custom fields value on inventory  Topic is solved

Postby Mike.Sheen » Thu Mar 04, 2021 4:47 pm

SBarnes wrote:I need to update a custom field value on the inventory item to the database without updating the inventory item i.e. I don't want the last saved date and time to update, will the following work where jinv is the business object?

Code: Select all
 jinv.CustomFieldValues.get_ItemFromSettingName("FieldName").Save(jinv.InventoryID);


It might - it's not something I'd recommend, though - and it'll cause the custom setting value's LastSavedDateTime to be updated - and although I suspect you just care about the IN_Main.LastSavedDateTime not changing - it would mean any subsequent save of the same custom field value will fail, as the LastSavedDateTime of the custom field will have changed between read and save.

You could just do a direct SQL Inert / Update on the table.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Updating a custom fields value on inventory

Postby SBarnes » Thu Mar 04, 2021 5:35 pm

Thanks, I hadn't considered that it may be easier to pass the business object into the routines and do one final save at the end.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests

cron