1

The standard case form component includes a case deflection component. Unfortunately we need our case form to do some things that are beyond the standard case form functionality. Is there a way to use the case deflection component on it's own? If not does anyone know if the logic is more complicated than executing a search on knowledge with the case title?

I hate that we have to replicate these components to add functionality to parts of them

1

You can use the case deflection component on its own, just need to tweak your form to register the event used by the deflection component and fire it with the field + field value parameters on field change or blur, for example:

sampleForm.cmp

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >

    <aura:registerEvent name="appEvent" type="selfService:caseCreateFieldChange"/>

    <lightning:recordEditForm aura:id="recordEditForm"
                       objectApiName="Case">

    <lightning:messages />

    <lightning:inputField fieldName="Subject" onchange="{!c.itemsChange}"/>
    <lightning:inputField fieldName="Description" onchange="{!c.itemsChange}"/>


    <lightning:button class="slds-m-top_small" type="submit" label="Create new" />

</lightning:recordEditForm>
</aura:component>

SampleController.js

({
 itemsChange : function(component, event, helper) {           
        var appEvent = $A.get("e.selfService:caseCreateFieldChange");
        appEvent.setParams({
            "modifiedField": event.getSource().get("v.fieldName"),
            "modifiedFieldValue": event.getSource().get("v.value")
        });

        appEvent.fire();
})

Notice, the OOTB community Case Deflection component will update automatically.

  • where did you find the documentation for the event selfService:caseCreateFieldChange? I can't find it anywhere... – mascot Mar 21 at 14:33
  • There isn’t any, we got access to it as an ISV – glls Mar 21 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.