getattachrec and javascript

 3 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Terry P
Veteran Member Send Private Message
Posts: 234
Veteran Member
I have a similar problem I'm working on that maybe this might be the solution. The problem is you can not query or display comments (which are stored as attachments in H_Pxxx files) with Portal forms - only by drilling down.

Lawson support pointed me to a utility getattachrec call. I don't know though is that can be called from within javascript in Design Studio. Has anyone used this utility?

Terry P
Veteran Member Send Private Message
Posts: 234
Veteran Member

I found this in the knowledge base, which says you can do this from within portal form using Design Studio. What I don't know is the proper format for the javascript code. Does anyone have same code I could modify that does a call similar to that shown?

 

You can use writeattach. writeattachrec and getattachrec are similar programs and they are documented on support.Lawson.com. Refer to those documents for field definitions. Use the notes below to write scripting to update comments using writeattach.exe. Here is the working URL to update the ADD URL on a requisition: http://mylawsonbox.com:14...ch.exe?_OUT=XML&_PDL =TEST1&_FN=REQHEADER&_IN=RQHSET1&K1=2500&K2=0001278&_ATYP =U&_AUDT=I&_USCH=http&_DATA=TRUE &_ATTR=TRUE&_AOBJ=TRUE&_OPM=M&_ECODE=FALSE&_AESC=IE &_ANAM=NAMEOFURL&_ATXT=MYTEXT Running this does an URL attachment to requisition number 1278 for company 2500 in product line TEST1. Note that the URL is simply "MYTEXT" and it should instead be something like “http://www.google.com/" which should be URL-encoded before using, in order to pass the “://” through. Use this in ProcessFlow by creating a Webrun object and assigning this URL or you can add it to a form in DesignStudio. This was written for RQ and will need to be rewritten for AP invoicing.

John Henley
Send Private Message
Posts: 3355

Terry, I split this off into a separate topic/thread.

Sometimes the best place to look for examples is within the Lawson applications themselves. There is a very example within the ESS/MSS performance management pages (see hrnet\goalAttachment.js, hrnet\careermanagement\lib\getattach.js). You could easily migrate that code to a shared page that is included in Design Studio...

Thanks for using the LawsonGuru.com forums!
John
Terry P
Veteran Member Send Private Message
Posts: 234
Veteran Member
That code helped a little, but not quite all the way. Here is my function:

//*********************************************************************************
// Do a call to see if there are any PO Comments.
// If so, display message
//*********************************************************************************
function getComment()
{
var s = ""

//Read Values from Form
var sCompany = lawForm.getDataValue("API-COMPANY")
var sPONumber = lawForm.getDataValue("API-PO-NUMBER")

//Construct call
var s = "http://" + window.location.host + "/cgi-lawson/getattach.exe?_OUT=XML_PDL=" + strPDL
s += "&_FN=PURCHORDER"
s += "&_IN=PCRSET1"
s += "&K1=" + sCompany //Company
s += "&K2=" //PO Code
s += "&K3=" + sPONumber //PO Number
s += "&K4=" //Release Number
s += "&_ATYP=P"
s += "&_AUDT=I"
s += "&_ERULE=FALSE"

//Return value from call
var objhttp = new ActiveXObject("Msxml2.XMLHTTP")
objhttp.Open("GET", s, false)
objhttp.Send("UserInfo")

//Display value from call
var vComment = objhttp.responseTEXT
alert("Comment:" + vComment)


return true;
}
//*********************************************************************************
//===================================================================================================

This is the part I don't think is working:
//Return value from call
var objhttp = new ActiveXObject("Msxml2.XMLHTTP")
objhttp.Open("GET", s, false)
objhttp.Send("UserInfo")

It says "the script request is not valid"