Set new line data when created

Hello all,

So I am in Quote entry and we have a UD field that is ProjectID. I was asked to be able to ensure two things:

  1. Before the user enters any lines, that they have entered a Project ID (QuoteHed.ProjectID)
  2. Set the project ID on the lines (QuoteDtl.ProjectID) when a new line is added to the quote.

For the first part I figured I could use a rule but I don’t want to disable the rows, I want to disable the entire grid.

For the second bit I tried an event in a few ways using row update but couldn’t get it to actually assign the data to the row.

Any insight?

I would use a bpm on Quote.GetNewQuoteDtl to handle both of those. The first step would be a condition to check for the existence of a ProjectID on the QuoteHed, and if it’s there assign that ProjectID to the new QuoteDtl line.

Throw a message on the false side of the condition to tell the user that they need to add a ProjectID.

3 Likes

I had considered something similar but I’m so confused on how to access QuoteHed. All i have access to is quotenum.

Since that method only includes the quoteNum and not the rest of the QuoteHed dataset, you’ll just have to look it up as the first step of your BPM.

This is my expression to look up the Project_ID_c field from QuoteHed:

(string)(from row in Db.QuoteHed where row.Company == callContextClient.CurrentCompany && row.QuoteNum == quoteNum
select row.Project_ID_c).FirstOrDefault()??""

Then your condition can check the ProjectID variable within the bpm.

Be sure to use the Raise Exception on the false side so it stops the method and doesn’t create the line.

Thinking this through more you’ll also have to use 2 BPMs, this one as a pre-processing, then on the true side of your condition Enable Post Directive and assign your project ID to a CallContextBPMData field. Then create a post-processing bpm to pull the projectID from the CallContextBPMData field and assign it to QuoteDtl.ProjectID.

Oh! interesting! Appreciate this! I actually got it working last night with just a custom code node.