Employee photo on HR11

 9 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
wilcoxmad
Veteran Member Send Private Message
Posts: 87
Veteran Member
I want to add code to our custom HR11 screen that will show the employee photo. Anyone done this?
wilcoxmad
Veteran Member Send Private Message
Posts: 87
Veteran Member
Ok, I found an example in the Lawson Design Studio Users Guide. It looks something like this: ----------------------------------------------- var sEmp = lawForm.getFormValue("text2"); sPath = "/law1/ca/lawson/persistdata/lawson/portal/content/images/"+sEmp+".jpg"; var imgElem = lawform.getFormElement("image1"); if (imgElem) { imgElem.src = sPath; imgElem.style.visibility = "visible"; } ------------------------------------------------- I am getting a message "LawForm is Undefined". And it points to the above lawform.getFormElement. Any suggestions?
David Williams
Veteran Member Send Private Message
Posts: 1127
Veteran Member
lawform.getFormElement should be lawForm
David Williams
wilcoxmad
Veteran Member Send Private Message
Posts: 87
Veteran Member
Thanks David, that was it. Not that it is working, but no more error.
David Williams
Veteran Member Send Private Message
Posts: 1127
Veteran Member
Do you actually have images loaded? Do an alert(sPath) to see what your call looks like to make sure it's clean.
David Williams
wilcoxmad
Veteran Member Send Private Message
Posts: 87
Veteran Member
How strange an adventure this has been! Figuring out where to place the .jpg files so Lawson will find them has been quite a challenge. The address $LAWDIR/persistdata/lawson/portal/content/images is where you put an image if you want to assign just one image to the form. Like if you wanted to show a company logo or something like that. You then assign it to the image you define in DS as the source, not in the JS. However if you want to build a variable and assign it on the fly, you need to put the images in the $LAWDIR/htdocs/lawson/images directory. However when building your path in JS, use "/lawson/images/filename.jpg" as the directory/filename. I don't know how much of this is consistent across all UNIX platforms and how much is specific to our Lawson setup. I just know this has been a real adventure! :-) Now with all that said, has anyone used something like this but called the pictures from a web address instead of from the UNIX box itself? That is what I would like to be able to do because our badge photo's are on another server within our firewall and I would rather pull them directly from there rather than having to develope a process to pull them over to our UNIX server.
Matt
Basic Member Send Private Message
Posts: 13
Basic Member
We have created a button on one of our custom applicant screens (PA31) that calls a simple Classic asp page that we developed that displays applicant photos. The applicant number is dynamically populated as a querystring. function BUTTON_OnClick(id, row) { var strURL = "http://production/laprod/PhotoUpload//DisplayPhoto.asp?ID=" + sAppID window.open(strURL,"PCT_Photo","fullscreen=no,location=no,menubar=no,width=280,height=400,resizable=no,scrollbars=no,status=yes,toolbar=no") } I hope this helps. I can give more details in how it works if you need it. Matt
LisaN
Veteran Member Send Private Message
Posts: 53
Veteran Member
Don't know if this helps you but through MSS the employee photos can be viewed under their direct reports: The photos have to have the naming convention of "P.jpg (I think you need leading zeroes in the EE#) The photos need to be in "WEBDIR/lawson/hrnet/images/employees I found that you can adjust the image size by modifing manager.htm in the "htdocs/lawson/xhrnet" folder. I also thought there was an option to have the images displayed on HR11.
Deleted User
New Member Send Private Message
Posts: 0
New Member
Here is the script I am using for this, and having one small issue - I can't lock the image into place and keep a consistent size. When our HR dept takes the pic, they are regularly cropped (and they don't lock the aspect ratio during cropping). This leads to very un-flattering photos being placed into portal if you use an absolute size. I hope I worded that coherently... Anyway, here goes: function FORM_OnInit() { //set the style for image control var imgElem=lawForm.getFormElement("image1"); if (imgElem) { imgElem.style.visibility = "hidden"; imgElem.style.top = "4px"; imgElem.style.left = "50%"; imgElem.style.height = "20%"; imgElem.style.height = "20%"; } } function FORM_OnAfterTransaction(data) { //was transaction successful? if (formState.agsError) return; // pad image names with zeroes for company and employee names // company is 4 chars, employees are 9 sEmployee = lawForm.getDataValue("EMP-EMPLOYEE",0); sCompany = lawForm.getDataValue("EMP-COMPANY",0); sCompany = portalWnd.strFillChar(sCompany,4,"left","0"); sEmployee = portalWnd.strFillChar(sEmployee,9,"left","0"); // build IMG url and set the control source sEmployee = "P" + sCompany + sEmployee; sPath = "/lawson/xhrnet/images/employees/"+sEmployee+".jpg" var imgElem = imgElem=lawForm.getFormElement("image1"); if (imgElem) { imgElem.src = sPath; imgElem.style.visibility = "visible"; } }
wilcoxmad
Veteran Member Send Private Message
Posts: 87
Veteran Member
Thanks all! I'm still looking for a way to address the photo's from a web server and load them directly to the form on an inquiry action. My users don't want a pop-up. I have been successful at pulling them from a Unix directory. Again the problem there is I would have to come up with a process to update the Unix daily with new employee's photos. I would much rather be able to pull them from the network server that already contains the photos.