Verify PO box during customer creation

I have the following requirement which I am not able to fully implement.

When creating a new customer in “DirPartyQuickCreateForm”, a validation needs to be done on the field “Street”. When any info is entered in the Street field, a pop up should appear asking if it is a PO box. If “Yes” is clicked, a PO box checkbox needs to be automatically be checked.

The “Street” field is in LogisticsPostaladdress table and the “IsPostalAddress” enum is in the DirPartyLocation table.

I created a method “CheckforPOBox” in “LogisticsPostaladdressMap” to implement the code to give the pop up when any info is entered in the street field, and called this method in the modified field of “locationpostaladdress table”.

However I get this error: Error executing code: The field with ID ‘0’ does not exist in table ‘LogisticsPostalAddress’.

PS: LogisticsPostaladdressMap does not have the dirpartylocation table in its mappings so I added it, created a field ispostalAddress in the map fields and mapped it to the IspostalAddress of the dirpartytable. Can I do this?

Hello Lohit,

i will go for below option in “DirPartyQuickCreateForm”

in class declaration , declare dialog

DialogButton diagBut;

override modified method in street field of LogisticspostalAddress datasource

public void modified()

{

super();

diagBut = Box::yesNo(‘is postal addredd’,DialogButton::No,‘postal address’);

if(diagBut == DialogButton::Yes)
{
dirPartyLocationPostalAddress.IsPrimary = NoYes::Yes;
dirPartyLocationPostalAddress.IsPostalAddress = NoYes::Yes;
}
else
{
dirPartyLocationPostalAddress.IsPrimary = NoYes::Yes;
dirPartyLocationPostalAddress.IsPostalAddress = NoYes::No;
}

}

Hey Kunal. Thanks, it works perfectly.

The only thing is, when I click Yes, in the dialog box, the IsPOBox checkBox is not automatically getting checked? It needs to be ticked and that needs to be visible in the form so that the call center exec will know that the checkbox is ticked. Do i need to write something to refresh the form?

Hello Lohit,

you will not able to refresh the form as it is not written in table currently when you are clicking on button , i will suggest to make auto declaration to true for this IsPOBox and make it ticked in the same modified method of street field