Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Regular Contributor
Gator
Posts: 270
Registered: 12-05-2008
0
Accepted Solution

4.4 Scripting - Extended Descriptions

I am working on a script that generates Purchase Orders when a Sales Order is saved (and yes I know this feature will be added later, but the client needs it now).

 

It is all working correctly, but I am not sure how to go about getting the extended description to copy over from the Sales Order line to the Purchase Order line.  I will play with this some more, but I was hoping someone had worked on this before and would have a quick answer.

 

Thanks in advance.

Regular Contributor
Gator
Posts: 270
Registered: 12-05-2008

Re: 4.4 Scripting - Extended Descriptions

OK, I finally figured this out.  There is apparently a property that is available to us in the memory channel of the lines (I had to look through the source code to find this as we are also an MD).  The extended description is held in "ExtDescriptionText$".  When I was looping through the S/O lines, I called:

 

retVal = oLines.GetValue("ExtDescriptionText$",extDescText)

 

But, this property can be blank if you have not editted the extended description.  So I had to also see if an Extended Description Key was available, and lastly I needed to have the Item Code Description available as follows:

 

 

retVal = oLines.GetValue("ItemCodeDesc$", itemCodeDesc)

extDescText2 = ""
extDescText = ""

retVal = oLines.GetValue("ExtDescriptionText$",extDescText2)
			
if Trim(extDescText2) = "" then 
	if Not(IsObject(oExtDescObj)) then
		Set oExtDescObj = oSession.AsObject(oSession.GetObject("CI_ExtendedDescription_bus"))
	end if

	retVal = oLines.GetValue("ExtendedDescriptionKey$",extDescKey)
	retVal = oExtDescObj.SetKey(extDescKey)
	retVal = oExtDescObj.GetValue("ExtendedDescriptionText$",extDescText)
	if Trim(extDescText)<> "" then
		itemCodeDesc = extDescText
	end if
else
	itemCodeDesc = extDescText2
end if

retVal = oPOLines.SetValue("ItemCode$", itemCode)

retVal = oPOLines.SetValue("ItemCodeDesc$", itemCodeDesc)