Quote to Standard Order not Firing Scripts

I have a few scripts on column post validates, mostly watching the order quantity.  I had them only running for standard orders, however this was an issue when the order starts as a quote.  One script is a calculation to mark the udf quantity pulled (basically what we have in stock).  I am thinking about removing the part of the script to check if it is a standard order and fire off on quotes as well.  However, when the order does convert over to a standard order I think we need to loop through the lines and run the calculations again to take into account the changing inventory levels.  This last part I do not know how to go about, edit this script or does this need a different script to run?  I was having issues with scripts running and ending up with correct value in the udf so I had to run two scripts first one on the column post val quantity orders then the second script on a table pre write, might be a better way to condense into one.

'qty pulled calculation if using the BO function looking at available qty through Sage
'column-postval qty ordered

rVal = 0
QBO = 0
QORD = 0
QPULLED = 0
sType = ""
sItemType = ""
nAPNo = ""
nVenNo = ""

rVal = oHeaderObj.GetValue("OrderType$", sType)
r=oScript.DebugPrint("OrderType: " & sType)
if sType = "S"  then

rVal = oBusObj.GetValue("ItemType$", sItemType)
r=oScript.DebugPrint("ItemType: " & sItemType)
	if trim(sItemType) = "1" then

	rVal = oBusObj.GetValue("QuantityOrdered", QORD)
	r=oScript.DebugPrint("QuantityOrdered: " & QORD)
	rVal = oBusObj.GetValue("QuantityBackordered", QBO)
	r=oScript.DebugPrint("QuantityBackordered: " & QBO)
		
		if QBO = 0 then

		rVal = oBusObj.SetValue("UDF_QTY_PULLED", QORD)
		rVal = oBusObj.SetValue("APDivisionNo$", nAPNo)
		rVal = oBusObj.SetValue("VendorNo$", nVenNo)

		end if

			if QBO > 0 then

			QPULLED = QORD-QBO

			rVal = oBusObj.SetValue("UDF_QTY_PULLED", QPULLED)

			end if

	end if

end if

'fix qty pulled field for qty pulled script colum post val qty bo

rVal = 0
QPULLED = 0
QPNEW = 0
QORD = 0
QBO = 0
sType = ""
sItemType = ""
APNo = ""
VenNo = ""

rVal = oHeaderObj.GetValue("OrderType$", sType)
r=oScript.DebugPrint("OrderType: " & sType)

if sType = "S"  then

rVal = oBusObj.GetValue("ItemType$", sItemType)
r=oScript.DebugPrint("ItemType: " & sItemType)

	if trim(sItemType) = "1" then

	rVal = oBusObj.GetValue("UDF_QTY_PULLED", QPULLED)
	r=oScript.DebugPrint("qtypulled: " & QPULLED)
	rVal = oBusObj.GetValue("QuantityBackordered", QBO)
	r=oScript.DebugPrint("QTYbo: " & QBO)
	rVal = oBusObj.GetValue("QuantityOrdered", QORD)
	r=oScript.DebugPrint("QTYORDERED: " & QORD)

		if QBO = 0 then

		rVal = oBusObj.SetValue("APDivisionNo$", APno)
		rVal = oBusObj.SetValue("VendorNo$", VenNo)

			if QBO > 0 then

			QPNEW = QORD-QBO

			rVal = oBusObj.SetValue("UDF_QTY_PULLED", QPNEW)
	
			end if
		end if
	end if
end if

Parents
  • 0

    It looks like you are relying on the Sage option to check quantity available during SO entry, and using math related to the BO quantity at that point. 

    That feature won't be re-triggered during conversion of a quote to SO.  To do that, you'd need a script to loop through lines, and trigger that new script somehow during the conversion from Quote to Standard.  Modern versions have an SO header field for "Promoted Date", which you might use for the trigger (column post-validate).

    The question I have is why you are calculating the UDF value in a script at all.  Simple report formulas can do that easily enough (without a script).

  • 0 in reply to Kevin M

    We are using two udfs one for in stock items (above) and one for items received (we want to link the items to the sales order the po was generated from, using auto generate purchase order function) to get a total count of "allocated" items for the order.  If the sum of those two udfs equals the total amount of the ordered quantity for all lines, then it checks off a flag "allocated", we then run the print pick sheet function and only print "allocated" orders.  Would this scenario still be applicable for report formulas?

Reply
  • 0 in reply to Kevin M

    We are using two udfs one for in stock items (above) and one for items received (we want to link the items to the sales order the po was generated from, using auto generate purchase order function) to get a total count of "allocated" items for the order.  If the sum of those two udfs equals the total amount of the ordered quantity for all lines, then it checks off a flag "allocated", we then run the print pick sheet function and only print "allocated" orders.  Would this scenario still be applicable for report formulas?

Children