We have workflow rule within Zoho inventory which updates the Purchase Order [Reference#] with the Sales Order [Reference#].
The issue is that the function takes time to execute.
The 'Save and Send' button cannot be used because the function has not executed yet, and the PO [Reference#] still has the incorrect value.
The 'Save as Draft' function does work, however it takes a minute or two to execute. If you refresh the browser page then the field updates and the PO can be sent to the supplier.
What I'm looking for is... if it is possible to automatically refresh the browser once the 'Save as Draft' button has been selected. This will mean that the email can be sent to the supplier, without having to remember to refresh the browser or wait 2 minutes.
Here is the custom function code:
purchaseorderID = purchaseorder.get('purchaseorder_id');
purchaseorderdate = purchaseorder.get('date').toDate();
organizationID = organization.get('organization_id');
if(purchaseorder.getJSON('reference_number') != '')
{
reference_no = purchaseorder.getJSON('reference_number');
res = zoho.inventory.getRecords('SalesOrders',organizationID,{ 'salesorder_number':reference_no} );
if(res.getJSON('message') == 'success')
{
so_reference = res.getJSON('salesorders').getJSON('reference_number');
update_po = zoho.inventory.updateRecord('PurchaseOrders',organizationID,purchaseorderID,{ 'reference_number':so_reference} );
info update_po;
}
}
About the recuiterMember since May 20, 2018 Litu
from Hessen, Germany