Skip to main content
Answer

Customization: Making the Quote and Opportunity Contact Required

  • October 21, 2024
  • 3 replies
  • 88 views

Forum|alt.badge.img

Good day,

I am developing a customization to make the selection of a Contact field required on both the Opportunity and Quote.  I know how to make the field required using the customizations.  However, I am concerned on how it could affect the workflow. Adding quotes, processing, action areas, etc.

For example; Opportunity/Quotes.  Are their any issues or problems that could arise.  Management wants sales reps to have contacts on all their opportunities and quotes.  We also have an Approval process for large quotes. Since the documents are interconnected, 

  1.  Should the customization be separate or together?
  2. I don’t want to slow down the Sales process; however it does present some issues with sales
  3. Approval process? issues
  4. Actions being affected; Convert to Order, etc.

Does anyone have a better suggestion?  Or a better way to go?

Thank you.

Best answer by darylbowman

I believe the most significant discomfort you would experience would be just after ‘go-live’, as every Opp and Quote not having a contact would require one before changes could be saved.

Unless you are creating either entity automatically, it should present fine to the user and allow for selection.

3 replies

Forum|alt.badge.img+8
  • Captain II
  • October 22, 2024

Hi @grillevan 

 

You could use the [PXDefault] attribute this would make the field required and throw an error when you try to save with the field not being populated.

 

This shouldn’t cause any real issues with workflows, except for enforcing the need for a contact.

 

You can add this in a CacheAttached event:

[PXMergeAttributes(MergeMethod = PXMergeMethod.Append)]
[PXDefault]
protected virtual void _(Events.CacheAttached<YourDAC.yourField> e) {}

Alternatively, I think you could add to the PXUIFieldAttribute, either through the CacheAttached or RowSelected handler.

Cache Attached:

[PXMergeMethod(Method = MergeMethod.Merge)]
[PXUIField(Required = true)]
protected virtual void _(Events.CacheAttached<YourDAC.yourField> e) {}

RowSelected:

protected virtual void _(Events.RowSelected<YourDAC> e, PXRowSelected b)
{
YourDAC row = e.Row;

b?.Invoke(e.Cache, e.Args);

PXUIFieldAttribute.SetRequired<YourDAC.yourField>(e.Cache, true);
}

Hope this helps.

Aleks


darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • October 22, 2024

I believe the most significant discomfort you would experience would be just after ‘go-live’, as every Opp and Quote not having a contact would require one before changes could be saved.

Unless you are creating either entity automatically, it should present fine to the user and allow for selection.


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • October 22, 2024

@aiwan 

I appreciate the code; it is a little above my pay grade.  I am not on the developer level yet.

 

I am basically going to publish a Project Customization that makes the ContactID required on the opportunity/quote form.

@darylbowman Much appreciated.