web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

javascript increment variable on parent record

(0) ShareShare
ReportReport
Posted on by 600

Hi

I have a variable on lead:   var activityNumber = "1";

I want to increment this number each time a new activity is created. To do this I have want to call this variable on the activity and increment, but I am not able to recall the variable. I have tried alert (window.top.opener.activityNumber); and just window.top.activityNumber but get error message that the variable is not defined. 

How can I get the variable and increment it from activity to lead. 

Many thanks for help! 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Martin,
    Why you are not creating real time workflow . I think this will be easiest way to do this using workflow  .

    Please have a look below reference where I have answered--

    https://community.dynamics.com/crm/f/117/t/308613

    In addition you can try with this -

    var no = window.parent.opener.Xrm.Page.getAttribute("new_activityno").getValue();
    var incrmentNo = no + 1;
    window.parent.opener.Xrm.Page.getAttribute("new_activityno").setValue(incrmentNo);


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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans