| | Added: <!-- wp:paragraph --> |
| | Added: <p><img src="https://i1.wp.com/www.jackvandijk.nl/NBA/NBA101/enhance.png?w=1500&ssl=1" alt="Enhance Icon" data-recalc-dims="1"> Also introduced in Summer ’19, the Enhance step allows you to modify a set of already existing recommendations using an Apex class. It takes a branch of recommendations as input (in the variable recommendations) and optionally custom attributes and returns the list of recommendations after you’ve modified them.</p> |
| | Added: <!-- /wp:paragraph --> |
| | Added: <!-- wp:paragraph --> |
Deleted: <p><img src="https://i1.wp.com/www.jackvandijk.nl/NBA/NBA101/enhance.png?w=1500&ssl=1" alt="Enhance Icon" data-recalc-dims="1" /> Also introduced in Summer ’19, the Enhance step allows you to modify a set of already existing recommendations using an Apex class. It takes a branch of recommendations as input (in the variable recommendations) and optionally custom attributes and returns the list of recommendations after you’ve modified them.</p><p>The typical use case for this is if you need to change something on the recommendations that goes beyond what you can do with the Map element. For example, things like doing calculations, doing additional lookups of data, etc, etc. For our example we’ll replace our Map call with an Enhance step and an Apex class doing exactly the same thing: making the user first name and the Subject of the case part of the description of the recommendation.</p><p>The Apex class for this:</p><pre>global class NBAEnhanceTemplate {
| Added: <p>The typical use case for this is if you need to change something on the recommendations that goes beyond what you can do with the Map element. For example, things like doing calculations, doing additional lookups of data, etc, etc. For our example we’ll replace our Map call with an Enhance step and an Apex class doing exactly the same thing: making the user first name and the Subject of the case part of the description of the recommendation.</p>
|
| | Added: <!-- /wp:paragraph --> |
| | Added: <!-- wp:paragraph --> |
| | Added: <p>The Apex class for this:</p> |
| | Added: <!-- /wp:paragraph --> |
| | Added: <!-- wp:preformatted --> |
| | Added: <pre class="wp-block-preformatted">global class NBAEnhanceTemplate { |
| Unchanged: @InvocableMethod( | Unchanged: @InvocableMethod( |
| Unchanged: label='NBA Enhance Example' | Unchanged: label='NBA Enhance Example' |
| Unchanged: description='This function updates the Descripion using the supplied input parameters') | Unchanged: description='This function updates the Descripion using the supplied input parameters') |
| Unchanged: global static List<List<Recommendation>> sampleMethod(List<NBAEnhanceTemplateRequest> inputRequests) { | Unchanged: global static List<List<Recommendation>> sampleMethod(List<NBAEnhanceTemplateRequest> inputRequests) { |
| Unchanged: List<List<Recommendation>> outputs = new List<List<Recommendation>>(); | Unchanged: List<List<Recommendation>> outputs = new List<List<Recommendation>>(); |
| Unchanged: for (NBAEnhanceTemplateRequest inputRequest : inputRequests) | Unchanged: for (NBAEnhanceTemplateRequest inputRequest : inputRequests) |
| Unchanged: { | Unchanged: { |
| Unchanged: List<Recommendation> singleRequestOutputs = new List<Recommendation>(); | Unchanged: List<Recommendation> singleRequestOutputs = new List<Recommendation>(); |
| Unchanged: | Unchanged: |
| Unchanged: for (Recommendation inputRecommendation : inputRequest.recommendations) | Unchanged: for (Recommendation inputRecommendation : inputRequest.recommendations) |
| Unchanged: { | Unchanged: { |
| Unchanged: inputRecommendation.Description = inputRequest.FirstInputVariable + ', ' + inputRecommendation.Description + ' for ' + inputRequest.SecondInputVariable; | Unchanged: inputRecommendation.Description = inputRequest.FirstInputVariable + ', ' + inputRecommendation.Description + ' for ' + inputRequest.SecondInputVariable; |
| Unchanged: | Unchanged: |
| Unchanged: singleRequestOutputs.add(inputRecommendation); | Unchanged: singleRequestOutputs.add(inputRecommendation); |
| Unchanged: } | Unchanged: } |
| Unchanged: outputs.add(singleRequestOutputs); | Unchanged: outputs.add(singleRequestOutputs); |
| Unchanged: } | Unchanged: } |
| Unchanged: return outputs; | Unchanged: return outputs; |
| Unchanged: } | Unchanged: } |
| Unchanged: | Unchanged: |
| Unchanged: | Unchanged: |
| Unchanged: global class NBAEnhanceTemplateRequest { | Unchanged: global class NBAEnhanceTemplateRequest { |
| Unchanged: @InvocableVariable | Unchanged: @InvocableVariable |
| Unchanged: global String FirstInputVariable; | Unchanged: global String FirstInputVariable; |
| Unchanged: | Unchanged: |
| Unchanged: @InvocableVariable | Unchanged: @InvocableVariable |
| Unchanged: global String SecondInputVariable; | Unchanged: global String SecondInputVariable; |
| Unchanged: | Unchanged: |
| Unchanged: @InvocableVariable | Unchanged: @InvocableVariable |
| Unchanged: global List recommendations; | Unchanged: global List recommendations; |
| Unchanged: } | Unchanged: } |
| | Added: </pre> |
| | Added: <!-- /wp:preformatted --> |
| | Added: <!-- wp:paragraph --> |
| | Added: <p>Then the Enhance step looks like this:</p> |
| | Added: <!-- /wp:paragraph --> |
| | Added: <!-- wp:image --> |
| Deleted: </pre><p>Then the Enhance step looks like this:</p><p><img src="https://i0.wp.com/www.jackvandijk.nl/NBA/NBA101/enhancescreenshot1.png?w=1500&ssl=1" alt="Enhance screenshot" data-recalc-dims="1" /></p><p>And the strategy is now:</p><p><img src="https://i0.wp.com/www.jackvandijk.nl/NBA/NBA101/enhancescreenshot2.png?w=1500&ssl=1" alt="Enhance screenshot" data-recalc-dims="1" /></p><p>And the final recommendation output looks, similar to what we had before, like this:</p><p><img src="https://i1.wp.com/www.jackvandijk.nl/NBA/NBA101/enhancescreenshot3.png?w=1500&ssl=1" alt="Enhance screenshot" data-recalc-dims="1" /></p><p><a href="https://unofficialsf.com/the-salesforce-automation-and-decisioning-wiki/elements-3/">Back to Elements</a></p> | Added: <figure class="wp-block-image"><img src="https://i0.wp.com/www.jackvandijk.nl/NBA/NBA101/enhancescreenshot1.png?w=1500&ssl=1" alt="Enhance screenshot"/></figure> |
| | Added: <!-- /wp:image --> |
| | Added: <!-- wp:paragraph --> |
| | Added: <p>And the strategy is now:</p> |
| | Added: <!-- /wp:paragraph --> |
| | Added: <!-- wp:image --> |
| | Added: <figure class="wp-block-image"><img src="https://i0.wp.com/www.jackvandijk.nl/NBA/NBA101/enhancescreenshot2.png?w=1500&ssl=1" alt="Enhance screenshot"/></figure> |
| | Added: <!-- /wp:image --> |
| | Added: <!-- wp:paragraph --> |
| | Added: <p>And the final recommendation output looks, similar to what we had before, like this:</p> |
| | Added: <!-- /wp:paragraph --> |
| | Added: <!-- wp:image --> |
| | Added: <figure class="wp-block-image"><img src="https://i1.wp.com/www.jackvandijk.nl/NBA/NBA101/enhancescreenshot3.png?w=1500&ssl=1" alt="Enhance screenshot"/></figure> |
| | Added: <!-- /wp:image --> |
| | Added: <!-- wp:paragraph --> |
| | Added: <p><a href="https://unofficialsf.com/the-salesforce-automation-and-decisioning-wiki/elements-3/">Back to Elements</a></p> |
| | Added: <!-- /wp:paragraph --> |