You are here:
Update Quote Context ID on Browser Refresh in Create Media Plan
In the Create Media Plan flow, when you enter the details on the Add & Configure Media Placement page and click Next, a quote is created and you’re directed to a page to configure the line items on the Grid. However, if the browser page is refreshed during line item configuration, you’re prompted to create another quote because the context ID still refers to the opportunity instead of the quote. Create a custom Lightning web component and add it to the Flexcard, so that the browser URL references the context ID of the quote.
This is an Advertising Sales Management on Managed Package feature. For Advertising Sales
Management on Salesforce Platform, see Advertising
Sales Management on Salesforce Platform.
| REQUIRED EDITIONS |
|---|
| Available in: Lightning Experience |
| Available in: all editions |
| REQUIRED USER PERMISSIONS | |
|---|---|
| To access Media Cloud advanced features: | MediaCloudPlus Runtime |
| To create, read, update, and delete Flexcards: | Omnistudio Admin |
- From the App Launcher, find and select LWC Designer.
-
To create a custom Lightning web component, click the
icon.
- Enter the Lightning web component name, and click Create.
-
In the Editor, enter this code:
import { namespaceDotNotation } from "vlocity_cmt/namespaceUtils"; import { LightningElement, api, track } from 'lwc'; import { OmniscriptBaseMixin } from 'vlocity_cmt/omniscriptBaseMixin'; import { LOCAL_OMNISCRIPT_ENABLED, getOmniJsonData, setOmniJsonData, getOmniDataMode } from "vlocity_cmt/sfiMediaUtility"; export default class customMediaPlanHandler extends OmniscriptBaseMixin(LightningElement) { @api osname; connectedCallback(){ getOmniDataMode(this, this.osname); if(this.osDataMode === LOCAL_OMNISCRIPT_ENABLED) { pubsub.fire("get-os-data", "result", { uniqueHandlerKey: "customLWC" }); } else { setOmniJsonData(this, {}); } let osData = getOmniJsonData(this, this.osname); if(osData && osData.cartId) { window.history.pushState(null, null, `/lightning/cmp/${namespaceDotNotation}__vlocityLWCOmniWrapper?c__target=c:vplAdsMediaPlanDetailsEnglish&c__layout=lightning&c__tabLabel=Configure Media Plan&c__tabIcon=custom:custom18&c__ContextId=${osData.cartId}&c__cartId=${osData.cartId}&c__isConfigure=true`); } } } - Save your changes.
- From the App Launcher, find and select Omnistudio Flexcards.
-
Select the Flexcards where the handlers are available for the specified media type.
Media Type Flexcard Name Digital sfiAdsDigitalGrid Television sfiAdsTVGrid
sfiAdsTvGridChild
Print sfiAdsPrintGrid Radio sfiAdsRadioCalendarGrid
sfiAdsRadioParentGrid
- Under Pagination Grid, add the custom handler.
- Click the Properties tab of the custom handler that you added.
- Under Attribute, add the osname attribute with the value c-vpl-ads-media-plan-details-english.
- Save your changes.
