Form Template(Summary) based on Document Type
As per current implementation of C4C, we can have different form template, for PDF Summary, based on Country and Language. We can set up rules so that such various templates can be used. But till date there is no way for template to be changed based on Transaction Type of document. Neither there is any provision for it to be based on any other fields like ‘Status’ or combinations. This solution is catered so that it will be able to have different kind of template/summary based on Document/Transaction Type and/or other fields.
Here as per our implementation, requirement was such that based on different document type and status of the document, generated summary should have different information to be displayed and look and feel to be altered as well.
To fulfill this requirement there is involvement of C4C system as well as certain coding involved in Adobe Form level scripting.
First, few things need to be considered like for how many countries and languages you want it to be customized. Depending on number of countries, languages and number of variations required for each, we should take call on whether we would like to do full blown custom solution without using Form Template Maintenance rules or modify many templates as per specific requirements for each country and language combination.
For our current requirement, we had to configure this template for more than 12 countries but advantage was that each template was required English language only. So, we had decided to go full blown custom solution, without using Form Template Rules, so that we need to not replicate same amount of efforts again and again for future enhancements to come.
In our requirements, we had to create few custom fields to hold certain information like quantity, list price, total cost etc. based on document type and status. For ex. We had to display Planned Quantity and Amount in few earlier statuses but it need to be changed to Actual Quantity and Amount in later statuses and for certain document types, it was always Actuals. Also, we had certain requirements like Discount need to be displayed as % to certain countries while for other it was to be displayed as calculated amount. For some countries, only cumulative discount needed to be displayed while for others it was one of the specific discount pricing components.
To satisfy this requirement, we had extended ServiceRequest business Object and have created KUT fields like Custom List Price, Custom Discount, Custom Total, Custom Quantity at item level. Before any extension to be done, these KUT fields need to be enabled on respective Form Template Schema. After this code was written in BeforeSave script of Item to have these fields filled with correct values from their respective standard counterpart fields based on requirement of country, status and document type. Below is just a sample code which can be considered,
Now this part which required changes in Cloud Application Studio is done. What we need further is in Adobe Live Cycle Developer. In Adobe Live Cycle Designer, you can literally do magics with scripting. For example, consider below two screen shots. They are of same Adobe Form but just with different data.
Based on above screenshots you can determine what all things can be done using Adobe Form scripts in same form.
Below is how sample form design looks like. This is just a single page out of 2 pages.
Below is script sample used in this Adobe Form,
FormServiceRequestConfirmation.bdyMain1.txtProcessingCode::initialize - (FormCalc, client) if(this.rawValue == "ZVSR" & (FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "Z5" | FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "Z6" | FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "Z7" | FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "Z8" | FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "Z1" | FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "Z2" | FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "Z3" | FormServiceRequestConfirmation.bdyMain1.userStatus.rawValue == "1" )) then FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmAccountManager.custSignature.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmDetails.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField1.caption.font.underline = "0" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField2.caption.font.underline = "0" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.DateTimeField1.caption.font.underline = "0" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField1.caption.font.fill.color.value = "112,173,71" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField2.caption.font.fill.color.value = "112,173,71" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.DateTimeField1.caption.font.fill.color.value = "112,173,71" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField1.caption.font.size = "11.5pt" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField2.caption.font.size = "11.5pt" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.DateTimeField1.caption.font.size = "11.5pt" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField1.caption.font.weight = "normal" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.TextField2.caption.font.weight = "normal" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmServiceInformation.DateTimeField1.caption.font.weight = "normal" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmVisitNotes.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmCustomerInfo.lblCust1.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmAccountManager.lblAccountMan1.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmAccountManager.lblAccountMan2.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmAccountManager.Rectangle5.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmSalesProposal.lblSalesPropos1.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmSalesProposal.frmSalesProposalTable.tblSalesPRoposal.border.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.Text9.presence = "hidden" FormServiceRequestConfirmation.pageSet.mstPage1.Text3.presence = "visible" else FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmQuoteInform.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmCustomerInfo.lblCustomer.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmAccountManager.lblAccountManager.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmCustomerInfo.txtContactName.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmCustomerInfo.txtContactPhone.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmCustomerInfo.txtContactEmail.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmHeadearDetails.frmCustomerInfo.Rectangle5.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmSalesProposal.lblSalesProposal.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmSalesProposal.frmSalesProposalTable.tblSalesPRoposal.HeaderRow.hdrPartID.rawValue = "Part ID" FormServiceRequestConfirmation.bdyMain1.bdyMain2.frmConditions.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.bdyMain2.Rectangle3.presence = "hidden" FormServiceRequestConfirmation.bdyMain1.Text12.presence = "hidden" endif
This is just a general direction and was part of the overall requirement that we had. There were numerous other requirements but overall idea remains same that one needs to realize this kind of requirement through Form scripting as there is no other standard way provided in C4C.
Let me know if certain parts are unclear or if any specifics are to be answered.