You need to sign in to do that
Don't have an account?
bhanu_prakash
Create case using chatbot
Hi Team,
Iam creating chatbot to create a case . I have created slot name as
description datatype as Text
Priority datatype as Text
and iam trying to create a case using inovcable case , unable to create case
case contact need to logined in user contact name and account name need to be logined user account name.
Thanks for advance
Iam creating chatbot to create a case . I have created slot name as
description datatype as Text
Priority datatype as Text
and iam trying to create a case using inovcable case , unable to create case
case contact need to logined in user contact name and account name need to be logined user account name.
public class ChatBotCreateCase { @InvocableMethod(label='Create a Case' description='New case creation for the specified text') public static List<Case> CreateCases(List<CreateCaseString> requests){ List<Case> results = new List<Case>(); for(CreateCaseString request: requests){ system.debug('Case Results:' +request.value); if(request.ObjCase !=null && request.ObjCase.Id != null && String.isNotBlank(request.value)){ User us = [select id, Name,User.Contact.AccountId,User.Contact.Name from User where id =: UserInfo.getUserId()]; Case newCase = request.ObjCase; newCase.Status = 'New'; newCase.Origin = 'Web'; newCase.Subject = 'Reach out to user ' + us.Contact.Name + ' having email id ' + us.Contact.Email + ' for following question '; insert newCase; list<User> communityUser = [select id, Name,User.Contact.AccountId,User.Contact.Name from User WHERE id =: UserInfo.getUserId()];{ User Currentuser = Communityuser[0]; Currentuser.Phone = request.value; update Currentuser; } return new List<Case>{newCase}; } } return new list<Case>{requests[0].Objcase}; } public class CreateCaseString{ @InvocableVariable public string value; @InvocableVariable public Case ObjCase; } }
Thanks for advance