Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Sage MAS Partner
JKatulka
Posts: 215
Registered: 07-19-2010
0

Add editable UDF to AR Invoice History Screen

My client woud like a field on the AR Invoice History header panel in which they can type notes.

 

By default, it seems the UDF will be read only (like all fields of a history object).  Is it possible to add an editable UDF to this screen?

 

Interestingly, I recently added some UDFs to the PO History screen which were able to be edited.

Justin
Sage MAS Partner
JKatulka
Posts: 215
Registered: 07-19-2010
0

Re: Add editable UDF to AR Invoice History Screen

Added a script and used the oScript object to programatically enable the field upon reading a record.

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

Re: Add editable UDF to AR Invoice History Screen

Hi Justin,

 

Although this may enable the field for editting, I don't think it will save that information to the Invoice Header/Detail records.

Sage MAS Partner
JKatulka
Posts: 215
Registered: 07-19-2010
0

Re: Add editable UDF to AR Invoice History Screen

Surprinsingly, moving off the record after editing this field prompted me to save.

 

Anyways, my client has changed their mind on what they need.

 

Now, I'm attempting to access the lines of the AR Invoice History via oBusObj, but the object doesn't seem to have a 'Lines' property.  According to the BOI Object reference, it should have a property named Detail_Object, but that property can't be recognized either.

 

Can I get a handle to the lines object using the Invoice History oBusObj?

Justin
Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: Add editable UDF to AR Invoice History Screen

[ Edited ]

The history header/detail files are not like data entry header/detail files.  It doesn't have a Lines property.  It has a Detail_Object property.  You may need to do the following to get it to work:

 

 oInvDetailObj = oBusObj.Detail_Object

 if oInvDetailObj<>0 then set oInvDetailObj=oSession.AsObject(oInvDetailObj)

 

Then do oInvDetailObj.SetKeyValue(), oInvDetailObj.SetKey(), etc...

 

 

 

 

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Sage MAS Partner
JKatulka
Posts: 215
Registered: 07-19-2010
0

Re: Add editable UDF to AR Invoice History Screen

[ Edited ]

Thanks Natasha.  I was able to get the object created.

 

From what I can tell, I will need to specify which records I need from the detail object.   I'm attempting to use the SetFilter method of the detail object to filter by invoice number/headerseqno and access only the lines related to the current invoice.  Is this the most efficient way to get those results?  It seems like the method is timing out and throwing an error in the script (this particular MAS company's AR History is very large)

 

I have the invoice number and headerseqno available - I'm wondering if I can come up with some logic to pass detailseqNo's to the SetKey() method to avoid searching through thousands of records for the 5 - 10 that I need.

 

If the header contains a linecount, and the detailSeqNos ALWAYS start with zero and will always be incremented by 1, I think I will be able to use setKey()

 

Thanks again.

 

EDIT: Repeatedly calling the detail objects SetKey() method in a loop with incremented DetailSeqNo worked great. 

Justin
Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: Add editable UDF to AR Invoice History Screen

You can use SetFilter like this:

retVal = oInvDetailObj.SetFilter("", invoiceNo+HeaderSeqNo)

 

Note that if you have invoice number shorter than 7 characters, you need to pad it with null.

 

Then you can move through the lines and test for EOF.

retVal = oInvDetailObj.MoveFirst()

retVal = oInvDetailObj.MoveNext()

oInvDetailObj.EOF

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Regular Contributor
Gator
Posts: 270
Registered: 12-05-2008
0

Re: Add editable UDF to AR Invoice History Screen

Just curious, but I thought SetBrowseFilter was used with the Move functions.  So SetFilter works with them too?

Sage MAS Partner
JKatulka
Posts: 215
Registered: 07-19-2010
0

Re: Add editable UDF to AR Invoice History Screen

I believe the history detail object is an exception to that rule.

 

But since you brought it up Gator, I was wondering if you found SetBrowseFilter more efficient than GetResultSets or vice versa?

Justin
Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: Add editable UDF to AR Invoice History Screen

If you use a service object, you have to use SetBrowseFilter().  If you use a business object,  you can use SetBrowseFilter()  or SetFilter().

 

I think that GetResultsSets() should be faster than SetFilter or SetBrowseFilter because you don't have to move through each line yourself.  If you want to write back, you have to read one line at a time.

 

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP