Purpose type field exist in Address tab in customer master form . Please help me to achieve this.
The business requires a Purpose Type field to be added to this form. I was able to create an unbounded string control with a lookup, but the challenge is linking it to the original field in the Address tab of the Customer Master form. Could you suggest the best approach for binding this field and ensuring the selected value reflects correctly in the Address tab?
First of all, find out what field or business logic is the Purpose Type form control bound to.
I can’t help you with that, because I see no Purpose Type at the Addresses tab of CustTable form.
Hi Martin,
It’s purpose field ( Logistics location roles -Type) .Invoice, delivery, business, consignment…
All right, I see that. It seems that you don’t know how to find the source of the data, so let me teach you a few steps.
Right-click the grid column header and highlight Form information in the context menu. There you’ll learn that it’s LocationRoles
control in LogisticsPostalAddressGrid
form (this form is embedded in CustTable
form).
Then go to Visual Studio, find LogisticsPostalAddressGrid
(e.g. by putting it as a filter of Application Explorer) and open it in the designer. Then find LocationRoles
control and look at its properties. You’ll find find that the data comes from locationRoles()
method of DirPartyPostalAddressView
data source. You can see that your assumption was wrong; the control isn’t bound to a field.
Now expand Methods node of DirPartyPostalAddressView
data source to see if it’s there. It’s not, therefore the method is defined directly on the view. Right-click the data source and choose Go to View DirPartyPostalAddressView
. Then look at code of the method:
display DirPartyAddressLocationRoleNames locationRoles()
{
return DirPartyLocation::selectRecId(this.PartyLocation).locationRoleNames();
}
You could use the method in DirPartyQuickCreateForm
, but note that the form seems to always use Business purpose. See this code init()
method, for instance:
businessLogisticsLocationRoleRecid = LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Business).RecId;
If it’s the case, you can always show Business
purpose, because there can’t be any other at this point. And if you want to support other types, showing the purpose isn’t sufficient. You’d have to change business logic of this form.
Yes ,the default purpose is business,but I should give the provision to the user to select any roles from the drop down at the time of customer creation.
Then merely showing the same thing as on customers don’t meet your requirements. You’ll have to give users a way to select the roles and change all the related logic of DirPartyQuickCreateForm
.
If I pass the string control value in the init method of the form. Still not working.