I would like to create a Job record while on an Opportunity, and would like to copy some of the fields from the Opportunity record to the new Job record.
In the example below, I have created a new Codeunit - however, as you can tell, the description field will be blank.
codeunit 50100 OpportunityToJob { trigger OnRun() begin newJob.INIT; newJob.Description := ''; newJob.INSERT; end; var newJob: Record Job; }
Now on the Opportunity card, I have created an action to run my Codeunt.
pageextension 50113 UpdateOpportunityCard extends "Opportunity Card" { actions { addlast(reporting) { action(CreateQuotingJob) { Caption = 'Create Job'; ApplicationArea = All; Image = Job; trigger OnAction(); begin OpportunityToJob.Run(); end; } } } var OpportunityToJob: Codeunit OpportunityToJob; }
My question is, how can I set the description field of the new Job to the Opportunities description value when running my codeunit? Is it possible to pass the entire record in as a parameter of OpportunityToJob?
Thanks!