postBenefitAssignment(benefitAssignmentId, providerId)

Updates Benefit Assignment records with Provider lookup, and creates Contact Contact Relationship and Party Role Relationship records for Mentoring participants.

Syntax 

1import { postBenefitAssignment } from 'lightning/industriesEducationPublicApi';
2
3postBenefitAssignment({ benefitAssignmentId: string, providerId: string }): Promise<MentoringBenefitAssignment>

Parameters 

Parameter NameTypeDescriptionRequired?
benefitAssignmentIdStringThe ID of the benefit assignment record.Yes
providerIdStringThe ID of the provider offering that’s associated with the benefit assignment.Yes

Returns 

A Promise object that resolves with the MentoringBenefitAssignment response.

Usage 

Call this function to update Benefit Assignment records with Provider lookup, and to create Contact Contact Relationship and Party Role Relationship records for Mentoring participants.

This example calls postBenefitAssignment() based on a Benefit Assignment ID and a Provider Offering ID. Replace the IDs with your own.

1import { LightningElement, api } from "lwc";
2import { postBenefitAssignment } from "lightning/industriesEducationPublicApi";
3
4export default class MentoringPostBenefitAssignment extends LightningElement {
5  results;
6  error;
7
8  async callPostBenefitAssignment() {
9    await postBenefitAssignment({
10      benefitAssignmentId: "000000000000000000",
11      providerId: "000000000000000000",
12    })
13      .then((response) => {
14        this.results = response;
15      })
16      .catch((e) => {
17        this.error = e;
18      });
19  }
20
21  connectedCallback() {
22    this.callPostBenefitAssignment();
23  }
24
25  @api
26  getWiredData() {
27    return this.results;
28  }
29
30  @api
31  getWiredError() {
32    return this.error;
33  }
34
35  @api
36  clearWiredData() {
37    this.results = undefined;
38  }
39
40  get wireResults() {
41    return this.results || this.error;
42  }
43
44  get wireDataString() {
45    return this.wireResults ? JSON.stringify(this.wireResults, null, 2) : "";
46  }
47}

This component displays the response of the postBenefitAssignment() call.

1<template>
2   <template if:true={wireResults}>
3       <div>Wire data retrieved</div>
4       <div class="scroller">
5           <pre>{wireDataString}</pre>
6       </div>
7   </template>
8</template>

For TypeScript users, the type definition for this module is provided by the @salesforce/lightning-types npm package.

Note

See Also