Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Create custom Phone Call Subject not showing

Posted on by Microsoft Employee

Hi experts, 

I have used the following code to add a custom phone call activity onSave of a case record.

/*This function will help to create PhoneCall Activity entity Record*/

function TaskCreation()
{
	//get Current Logged in User name
	var UserName=Xrm.Page.context.getUserName();
	
	//get Logged is user GUID
	var UserId=Xrm.Page.data.entity.getId();
	
	//Get Current timer value
	var TimerValue = Xrm.Page.getAttribute("new_timer").getValue();
	
	//Get Primary Contact
	var con = Xrm.Page.getAttribute("customerid").getValue();
    
	
	//Set Task Activity Entity record
	var Task = {};
	Task.Subject = "Call Timing of User "+UserName; //set task subject
	Task.Description = "Call Running Time is "+TimerValue+" and User Name: "+UserName; //set Task Description
	Task.RegardingObjectId = { Id: Xrm.Page.data.entity.getId(), LogicalName: 'incident'}; //set parent entity type
	
	
	//finally create Task
	SDK.REST.createRecord(Task,"PhoneCall",
	function (Task)
	{
		writeMessage("The phonecall with Subject \"" + Task.Subject + "\" was created");
	},errorHandler);
		
	//Error handling
	function errorHandler(error)
	{
		writeMessage(error.message);
	}
	
}


The problem is the the customer name is not populating and in the view it is showing it as "Customer Not found"

6675.df.png

Is there something missing in my script?

Thanks

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Create custom Phone Call Subject not showing

    Hi everyone,

    Thanks for the replies.

    Can anyone please help me out with syntax that I can use to accomplish the same?

    Thanks!

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Create custom Phone Call Subject not showing

    Can you try with this code from below link

    community.dynamics.com/.../268185

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Create custom Phone Call Subject not showing

    Yes, you are not setting field "to" in your Phone Call

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Create custom Phone Call Subject not showing

    Hi Jon,

    Customer not found is visible cause you are not setting the CallTo field.

    As callto is a partylist you would need special handling. Please refer this thread.

    scaleablesolutions.com/create-activity-party-using-javascript-and-rest

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans