Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Sage MAS Partner
kenny
Posts: 14
Registered: 10-04-2010
0

Script to retrieve data in SO Lines

Hoping someone can help with some code on a script. I am using MAS90 4.40. I created a UDF in SO Lines and I am trying to copy the Desc of the GL Sales Account in SO Lines into the UDF. I need to do this while the user is on each line because additional processing takes place on the UDF and needs to be displayed on the line. I can get to data in that object using GetVal() and SetVal but I guess my question is how do I get to data that is not in that object.

Thanks

Super Contributor
connex
Posts: 794
Registered: 10-29-2008
0

Re: Script to retrieve data in SO Lines

 
Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Super Contributor
connex
Posts: 794
Registered: 10-29-2008
0

Re: Script to retrieve data in SO Lines

Try this:

 

SET oGLAcct = oBusObj.AsObject(oBusObj.GetChildHandle("SalesAcctKey"))

sAccountDesc = ""

retVal = oGLAcct.GetValue("AccountDesc$", sAccountDesc)

 

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Sage MAS Partner
kenny
Posts: 14
Registered: 10-04-2010
0

Re: Script to retrieve data in SO Lines

Dan, thank you. I will try it and let you know. If you could help me out with one more I'd appreciate it. In the same scenario I also need to retrieve the taxclassdesc entered on the SO Line. Sorry, I'm kinda new to this and not sure where to get all the Objects/Methods etc. 

Super Contributor
connex
Posts: 794
Registered: 10-29-2008
0

Re: Script to retrieve data in SO Lines

You should have been able to follow the pattern...

 

SET oTaxClass = oBusObj.AsObject(oBusObj.GetChildHandle("TaxClass"))

sTaxClassDesc = "Nothing Returned"

retVal = oTaxClass.GetValue("TaxClassDesc$", sTaxClassDesc)

 

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Sage MAS Partner
kenny
Posts: 14
Registered: 10-04-2010
0

Re: Script to retrieve data in SO Lines

Dan, It did work but not doing exactly what I need. I think I will email you directly. Thanks for all your help

Sage Employee
jepritch
Posts: 236
Registered: 08-25-2009
0

Re: Script to retrieve data in SO Lines

Hi Kenny,

 

Depending on what you are intending to do with these descriptions, you may not need any scripting at all.  If all you want to do is have the Sales Account Description display in Sales Order Entry, you don't even need to add a UDF.

 

1. Custom Office/Customizer Selection

2. Choose Sales Order/Sales Order Entry

3. Select DLINES

4. Dbl-Click the secondary grid (or primary one if that's where you want the description)

5. Click the Add fields button on the right side

6. When the field selection window appears, click the Show All button (this will show Sage's fields and not just UDF's)

7. Scroll down and expand the SALESACCTKEY folder

8. Choose AccountDesc

 

This adds the description as a display-only field into your secondary grid.

 

If you want the user to modify the description VIA a UDF then you can also do this without Scripting.  When you define your UDF, instead of making it Manual Entry, source it from the SO_SalesOrderDetail_bus Business Object.  Select the Data Source of SalesAcctKey and select the AccountDesc for the Column.   Then you can add this to your grid in Customizer Selection like above, just select your UDF instead.  Now, it will default to the normal description and you can edit it to display on the journal or wherever.

 

Just food for thought.  Scripting is very powerful, but so is the regular inherent abilities of customizer. :smileyhappy:

 

Elliott

 

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

Re: Script to retrieve data in SO Lines

Small correction:  PLINES instead of DLINES

Sage Employee
jepritch
Posts: 236
Registered: 08-25-2009
0

Re: Script to retrieve data in SO Lines

Thanks Gator :smileyhappy:

Sage MAS Partner
kenny
Posts: 14
Registered: 10-04-2010
0

Re: Script to retrieve data in SO Lines

Thanks Elliot, I already tried the UDF route, it will not actually bring it over for editing while the user is enetering the order lines.  It only saves it after the order is saved. I looked in DFDM and its there but I cannot see the desc in the UDF during data entry.