Skip to main content

Notifications

Customer Service forum

Creating a case against contact only

Posted on by Microsoft Employee

Hi,

I have the following requirement from a potential client in the service management module:-

1) Case can only be raised by a contact (not customer/account as per default)

2) Case can be regarding an account but not raised by an account (so a contact raises a case and might say it is regarding account B. We should be able to show that on the case record and be able to see all recent cases against the account as well as the contact.)

3) The contact raising the issue might not be related to the account at all.

How do i do this? Case management has customer field as mandatory and if you choose an account, you can't choose a contact not related to the account. I am at a bit of a loss on how to configure this and is there would be repercussions.

Thanks!

J

Categories:
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Creating a case against contact only

    Works like a charm. Thank you!

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Creating a case against contact only

    Oops. I forget to mention that while registering the method, you need to pass execution context. refer the second point in the below thread-

    docs.microsoft.com/.../walkthrough-write-your-first-client-script

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Creating a case against contact only

    Hi Ravi,

    Thanks for this. I get an error msg when i try to use your script. I created an onload control that calls setcustomerfieldtocontactinly function

    pastedimage1563416095774v1.png

    I am not a coder and this is the first time i have dealt with scripts so any help would be appreciated.

    Thanks!

    J

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Creating a case against contact only

    As an alternate solution, you can restrict the customer lookup to display only contact record (not account) so this way you could still use the system as is (you need to create separate Account field for your 2nd requirement though).

    You can refer the below scripts for either copy or setting default to contact-

    ==============================

    function setCustomerFieldToContactOnly(executionContext) {

       var formContext = executionContext.getFormContext(); // get formContext

       formContext.getControl("customerid").setEntityTypes(["contact"]);

    }

    ================

    Hope this helps

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Creating a case against contact only

    Hi,

    1) You cannot remove Customer field as it is sytem required however you can write a javscript to copy the value from Contact field to Customer field. You can then hide the customer field and make Contact field as required.

    2) For this, you can create a new lookup field "Account". This should help you achieve your requirement.

    3) By doing the above 2, you will not face this issue

    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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,297 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans