Do anyone have any idea how we can customize the existing fields. I need to customize source dropdown for the Leads screen need to add a few more options to that dropdown.
I don’t work in that screen, but I do have some combo boxes that I override the list. Just be sure you don’t need to account for business logic for different options.
When the record is selected, use SetList from PXStringListAttribute to replace the allowed values and allowed labels. Then add a class for your new selection list and inherit from PXStringListAttribute. Add an array for the allowed values and another for their respective labels. See below for an example.
#region MyDAC_RowSelected
protected void _(Events.RowSelected<MyDAC> e)
{
MyDAC row = (MyDAC)e.Row;
SelectableDispositions listattr = new();
PXStringListAttribute.SetList<MyDAC.disposition>(e.Cache, row, listattr.AllowedValues, listattr.AllowedLabels);
}
#endregion
#region SelectableDispositions
public class SelectableDispositions : PXStringListAttribute
{
public class ListAttribute : PXStringListAttribute
{
public ListAttribute() : base(
new[]
{
Pair(MyDAC.Dispositions.None, MyNS.IN.Messages.None),
Pair(MyDAC.Dispositions.Disp1, MyNS.IN.Messages.Disp1),
Pair(MyDAC.Dispositions.Disp2, MyNS.IN.Messages.Disp2),
Pair(MyDAC.Dispositions.Disp3, MyNS.IN.Messages.Disp3),
})
{ }
}
public string[] AllowedLabels = new string[]
{
MyNS.IN.Messages.None,
MyNS.IN.Messages.Disp1,
MyNS.IN.Messages.Disp2,
MyNS.IN.Messages.Disp3
};
public string[] AllowedValues = new string[]
{
MyDAC.Dispositions.None,
MyDAC.Dispositions.Disp1,
MyDAC.Dispositions.Disp2,
MyDAC.Dispositions.Disp3
};
}
#endregion
In my case, I define the combo box list with all my options initially, but then I want to remove certain options for the user to select, so I override the list using the code sample above to define only the options I want the user to select at the time.
Hi
- Add the Leads screen to the Customization project
- Then add the Combox box values to the Source field in the Fields section
- Inherit the Default Workflow and then add these new combobox values to the each step like shown in the screenshot.
Please find the screenshots for reference, also, attached customization package for your reference.
Hi
Then after, as indicated above you need to inherit the default workflow and add these to each status of each workflow step.
Be cautious with upgrades when you do this in the GUI version of workflow. We switched to code-based workflow recently because every upgrade had issues when the workflows would not allow us to upgrade naturally. We had to recreate the GUI workflow every time until I wrote them in code, and now no issues with upgrades. I do not have an example of how to write this in code on workflow.
I think both of the ways are applicable if you have only one dropdown. But I came to know that there are multiple places where this dropdown is used. So I need to find all the instances where this was used and do all the process. I looked into source code and found that they have created an attribute for the source field [CRMSources] and there they are declaring the options in PXStringList If by any way we can override that we don’t need to make changes at multiple places.
If you want to replace the list globally everywhere that field of the DAC is used, you will want to use a DAC extension and replace the defined list with your own. You should be able to remove the current list with PXRemoveBaseAttribute and append an attribute of your new list. Something like this, assuming you know how to make your new list attribute…
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRemoveBaseAttribute(typeof(CRMSourcesAttribute))]
[MyCRMSourcesAttribute.List]
public String Source { get; set; }
The bigger question is, do you want to replace it only for CRLead as used on that screen or for the base DAC of CR.Contact which has a vastly larger presence in the system? That would determine if you need to apply the DAC extension on CRLead or on Contact.
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.