cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe Livecycle Designer (using data in print forms)

former_member808112
Discoverer

I have invoice with seller Almika (1INV-72-2021).

I need to use in my print form field Manager Name.

But this data is missing in the XML structure when I click the "View Data XML" button.

How can I use this field in my print form in Adobe Livecycle Designer?

Accepted Solutions (0)

Answers (1)

Answers (1)

JohnMeadows
Product and Topic Expert
Product and Topic Expert
0 Kudos

To make this work you will need to first add an extension field to the CustomerInvoice business object to hold the Manager/Employee Name.

import AP.Common.GDT;
import AP.CustomerInvoicing.Global;

[Extension] businessobject AP.CustomerInvoicing.Global:CustomerInvoiceRequest {
		node CustomerInvoiceRequest {
		[Label("Selling Unit Manager")] element SUManager:LongText;	   
   		node Item {
   	    } 
     } 
}

You should also create a Process Extension to add this field to the Customer Invoice Object

add this extension to your Business Object definition like this:

[Label("Selling Unit Manager")][Scenario (PES_CustInvoice)] element SUManager:LongText;

You will then need to execute some ABSL code, during the OnModify event of the CI object to retrieve the managers ID from the Org Structure and populate the extension field.

import ABSL;
import AP.FO.Party.Global;
import AP.FO.MOM.Global;
foreach(var request in this){
	if(request.SellerParty.IsSet()){
		var sellerParty = Party.Retrieve(request.SellerParty.Party.UUID);
		if(sellerParty.IsSet()){
			request.SUManager = request.SellerParty.Party.ReportingLineUnit.CurrentResponsibleManager.GetFirst().ResponsibleManagingEmployee.CurrentCommon.BusinessPartnerFormattedName;
			var name = request.SUManager;
		}
	}
}

This isn't particularly elegant, and it assumes there is always a manager. You should use a query and check for existing manager, otherwise if there is no manager assigned to the org unit, this code will create a dump due to a null value being assigned.

Now add a business object extension for the customer invoice, activate it and then "Enhance Form"

Add the field to the form, save and exit! Now from Easy Form Editor you can add your new field.

With this solution you don't need the Adobe Form Editor. I made the decision to use Customer Invoice Request rather than customer invoice, since in some circumstances the invoice event "onModify" isn't always triggered during the invoice creation process, and sometimes the header information is set to "Read-Only" this doesn't happen if you use the invoice request object first. The process extension ensures data is copied across.

A somewhat complex process to solve a simple problem! I imagine that the ABSL script to get the manager can be simplified!

John