Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

set default during value in task

Posted on by 2,397

Hi, how can we set the default value in task, it got be through javascript?

*This post is locked for comments

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: set default during value in task

    Did you add getFormType condition?

    function defaultDuration()

    {

       if(Xrm.Page.ui.getFormType() == 1) Xrm.Page.getAttribute("actualdurationminutes").setValue(1440);

    }

  • sdnd2000 Profile Picture
    sdnd2000 2,397 on at
    RE: set default during value in task

    Thanks Alex,

    this will work for every new task,  but it still sets the existing task values, when opening the existing task.

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: set default during value in task

    This works in the onload:

    function defaultDuration()

    {

     Xrm.Page.getAttribute("actualdurationminutes").setValue(1440);

    }

    Though you may want to add form type check (so it only works on create):

    if(Xrm.Page.ui.getFormType() == 1)

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: set default during value in task

    Yes, I can see the problem - it does not work for me either.. maybe a javascript, but I'll need to try.. (it seems to be one of those special controls in Dynamics.. you can actually type in, say, 600.. and you'll get 10 hours.. even though 10 hours is not in the dropdown.. but it's definitely not working with the business rule for some reason)

  • sdnd2000 Profile Picture
    sdnd2000 2,397 on at
    RE: set default during value in task

    I am trying to use business rule, but how can I set the default value to "1 Day", it looks like it only accept digits

    3404.2017_2D00_08_2D00_25_5F00_1323.png

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: set default during value in task

    Hi,

     I guess you might try using a business rule, a javascript, or a workflow. Depending on where you need this to work and how complicated the rules are..

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