• Ashish Khairkar
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
We have come up with an interesting case management solution using the templates and algorithms of Prediction IO

Step 1: Using email-to-case feature a customer will mail his/her issue to a routing email-address and a Case will get created with Email Subject as Case Subject and Email body as Case Description
 
Step 2: As soon as case is created, Prediction IO will predict the most relevant article from the set of Article Management for the case. After the article is predicted, it will get attached to the Created Case and the status of Case will move to ‘On Hold’. We have trained a model in PredictionIO using the 'text classification' template and as a input to that template we are sending the Case Subject of Closed cases and Article Title associated with those closed cases based on whcih for any new case the most relevant article is predicted.
 
Step 3: After the article is attached to case, an email will be sent to the Case Creator based on predefined SFDC template with the solution article attached as pdf file with the mail. User will be asked whether the solution case article is relevant for your problem or not. And if yes, the case can be closed.

Step 4: If the customer replies that the article seems to be relevant and case can be closed, then the case will get automatically closed.

The best part of this is that it is completely automated, customer just have to mail theproblem

 
I have a Realted list on Case Object Layout "Case Product List"

Now i have written Rest calss which would create a case and populate account and contact information in it.

But i want this "Case Product List" to be alos poulated via the rest class. How can i achieve this

Below is my Rest Code
@RestResource(urlMapping='/RestServiceCreateCase/*')
global with sharing class RESTCreateCaseController {

@HttpPost   
  global static responseClass createNewCase(string ContactName,string AccountName,string ShipToAccName,string BusinessUnit,string SalesRep,string ProductName,string Quantity)
   {
     System.debug('Name: '+ContactName);
     System.debug('AccountName: '+AccountName);
     System.debug('ShipToAccount: '+ShipToAccName);
     System.debug('BusinessUnit: '+BusinessUnit);
     System.debug('SalesRep : '+SalesRep);
     System.debug('ProductName: '+ProductName);
     System.debug('Quantity: '+Quantity);
         
     responseClass rc=new responseClass();
      
    List<Account> Acc = [Select ID, Name, Account_Type__c from Account where Name =:AccountName limit 1];   
     system.debug(Acc);
  
     if(Acc.isEmpty())
        {
          Account NewAccount = new Account (
                                            Name = AccountName,
                                            Account_Type__c = 'MCO'
                                           );
         insert NewAccount;
         Acc = [Select ID, Name, Account_Type__c from Account where Name =:AccountName]; 
         system.debug('Insert Account :'+Acc); 
        }
     else
      {
      if(Acc[0].id != Null)
          {
          system.debug('Account Present'+Acc); 
          } 
      }
    
    List<Account> STAcc = [Select ID, Name, Account_Type__c from Account where Name =:ShipToAccName limit 1];   
     system.debug(STAcc);
  
     if(STAcc.isEmpty())
        {
          Account NewAccount = new Account (
                                            Name = ShipToAccName,
                                            Account_Type__c = 'MCO'
                                           );
         insert NewAccount;
         STAcc = [Select ID, Name, Account_Type__c from Account where Name =:ShipToAccName]; 
         system.debug('Insert Account :'+STAcc); 
        }
     else
      {
      if(STAcc[0].id != Null)
          {
          system.debug('ST Account Present'+STAcc); 
          } 
      }
    
   List<Contact> Con = [Select ID, Name, Email from Contact where LastName =:ContactName limit 1];   
     system.debug(Con );
    
     if(Con.isEmpty())
        {
         Contact NewContact = new Contact (LastName = ContactName);
         insert NewContact;
         Con = [Select ID, Name, Email from Contact where Name =:ContactName]; 
         system.debug('Insert Contact:'+Con); 
        }
     else
      {
      if(Con[0].id != Null)
          {
          system.debug('Contact Present'+Con); 
          } 
      }
    List<User> SelRep = [Select ID, Name from User where Name =:SalesRep limit 1];   
    system.debug(SelRep );
   
    system.debug(Acc[0].id);
    system.debug(Con[0].id);
    system.debug(SelRep[0].id);
    system.debug(STAcc[0].id);   
    
     Case c = new Case();
     c.Status = 'Open';
     c.Origin ='Web';
     c.Service_AGN__c = 'Queixa Profissional Saúde';
     c.Reason = 'Evento Adverso';
     c.Type = 'Update';
     c.Donation_or_Replacement_AGN__c = 'Pharma Complaint';
     c.Sales_Rep_Requester_AGN__c = '0055800000121ma';
     c.Priority = 'Low';
     c.Business_Unit_AGN__c='Ophthalmology';
     c.Complaint_Division_AGN__c='Pharma Complaint';
     c.Patient_AGN__c='a5U6E0000004FLm';
     c.Description='Account Email Update';
     c.AccountId=Acc[0].id;
     c.Ship_To_Account_AGN__c=STAcc[0].id;
     c.ContactId=Con[0].id;    
     insert c;
     system.debug(c); 
      
     Case c1 = [SELECT Id,  CaseNumber FROM Case Where Id =:c.Id];
     rc.CaseNumber= c1.CaseNumber;
     system.debug(rc); 
     return rc;    
  }
  
 global class responseClass{
       string CaseNumber;
   } 
  
}
This is how Case Product List is mapped to Case object
i have this follwing custom page on New Casebutton. But i want only the USers with "Standard User" profile should view this page on NEW CASE button

System admin should view the standard Case page.

How can i configure this


<apex:page standardController="Case">
  <style>
    #spinner{
        display: none;
        width:200px;
        height: 50px;
        position: fixed;
        top: 50%;
        left: 50%;
        text-align:center;
        padding:10px;
        font:normal 16px Tahoma, Geneva, sans-serif;
        margin-left: -100px;
        margin-top: -100px;
        z-index:2;
        overflow: auto;
        border:1px solid #CCC;
        background-color:white;
        z-index:100;
        padding:5px;
        line-height:20px;
     }
     #opaque {
         position: fixed;
         top: 0px;
         left: 0px;
         width: 100%;
         height: 100%;
         z-index: 1;
         display: none;
         background-color: gray;
         filter: alpha(opacity=30);
         opacity: 0.3;
         -moz-opacity:0.3;
         -khtml-opacity:0.3
     }
     * html #opaque {
         position: absolute;
     }
  </style>

  <apex:form >
  
    <apex:pageMessages id="msgs" />
    <apex:pageBlock mode="mainDetail" title="Create Case">
     
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}" onclick="showSpinner()" />
        <apex:commandButton value="Cancel" action="{!cancel}" onclick="showSpinner()" />
      </apex:pageBlockButtons>
      
      <apex:pageBlockSection title="Details" columns="1">
        <apex:inputField value="{!Case.Subject}" />
        <apex:inputField style="width:80%" value="{!Case.Description}" />
      </apex:pageBlockSection>
      
      <apex:pageBlockSection >
        <apex:inputField value="{!Case.AccountId}" />
        <apex:inputField value="{!Case.Type}" />
        <apex:inputField value="{!Case.Priority}" />
        <apex:inputField value="{!Case.Status}" />
        <apex:inputField value="{!Case.Origin}" />
        <apex:inputField value="{!Case.Reason}" />
      </apex:pageBlockSection>
      
    </apex:pageBlock>    
  </apex:form> 
   <div id="opaque"/>
   <div id="spinner">
        <p align="center" style='{font-family:"Arial", Helvetica, sans-serif; font-size:20px;}'><apex:image value="/img/loading.gif"/>&nbsp;Please wait</p>
   </div>
   
   <script>
    function showSpinner()
    {
       document.getElementById('opaque').style.display='block';
       var popUp = document.getElementById('spinner');
      
       popUp.style.display = 'block';
    } 
   </script>

</apex:page>

 
Suppose i have to build follwoing scenario

Two objects A & B have a master detail relationship, A being the master and B can contain many number of records

But only one record in B can be primary to A, say a Primary Flag field exist on B

When i check the Primary Flag of any new record in B, then the primary flag on old record should disappear 
We have come up with an interesting case management solution using the templates and algorithms of Prediction IO

Step 1: Using email-to-case feature a customer will mail his/her issue to a routing email-address and a Case will get created with Email Subject as Case Subject and Email body as Case Description
 
Step 2: As soon as case is created, Prediction IO will predict the most relevant article from the set of Article Management for the case. After the article is predicted, it will get attached to the Created Case and the status of Case will move to ‘On Hold’. We have trained a model in PredictionIO using the 'text classification' template and as a input to that template we are sending the Case Subject of Closed cases and Article Title associated with those closed cases based on whcih for any new case the most relevant article is predicted.
 
Step 3: After the article is attached to case, an email will be sent to the Case Creator based on predefined SFDC template with the solution article attached as pdf file with the mail. User will be asked whether the solution case article is relevant for your problem or not. And if yes, the case can be closed.

Step 4: If the customer replies that the article seems to be relevant and case can be closed, then the case will get automatically closed.

The best part of this is that it is completely automated, customer just have to mail theproblem

 
Hi Everyone
 Does the owner become the case owner if someone attaches a file? 
I'm stuck on step #5 of Einstein Analytics and Discovery Insights Specialist superbadge

Deliver a Solution to Reduce Subscriber Attrition
Note: The requirements for this challenge changed because of new functionality introduced in recent releases. Analyze a dataset, create a story, and add its add it's prediction and prescriptions to a Salesforce object.

Can anyone help in completing this step.

Thnaks in advance!
Suppose i have to build follwoing scenario

Two objects A & B have a master detail relationship, A being the master and B can contain many number of records

But only one record in B can be primary to A, say a Primary Flag field exist on B

When i check the Primary Flag of any new record in B, then the primary flag on old record should disappear