Resources for IT Professionals > Dynamics Forums > CRM Development > Substract one Case from the Contract Line Entity
Ask a questionAsk a question
 

Proposed AnswerSubstract one Case from the Contract Line Entity

  • Wednesday, November 04, 2009 3:17 PMManuel Altermatt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello Community,

    Quick question. I've created a Custom Relationship with a relation to the Contract Line Entity. Through use JavaScript within my Custom Entity, I've been able to identify the Contract Line related to my Custom Entity and read all its values.

    The problem comes when trying to change any value. For example, I would like to substract one case from the reamining amount of cases. However, given that the Contract Line belongs to a Contract that has already been invoiced, it seems that the Contract Line is read only.

    I am assuming there must be ways to change its values, given that my very example (substracting one case from the remaining cases) is something that CRM does natively when resolving a case. Are there any functions or ways to change values from a invoiced contract line?

    Thanks a lot and take care
    manuel_altermatt@hotmail.com

All Replies

  • Thursday, November 05, 2009 4:05 AMDaniel Cai Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer

    What I would try to do, in your case, is to change statuscode of Invoiced from one statecode to another one, for example, you could change it to to Draft or Active statecode. Then you will be fine to change any contract line that belongs to an invoiced contract. By doing so, you could potentially break some native CRM contract function, but most likely not. I have done similar implementation to salesorder entity due to similar business requirement, which just worked perfectly fine.

    After such change, you could implement some form script and plugin code for Contract entity to prohibit unexpected updates to the contract itself.

    Hope this helps.


    Daniel Cai | http://danielcai.blogspot.com
    • Proposed As Answer byMSCRM Blogger Thursday, November 05, 2009 12:21 PM
    • Edited byDaniel Cai Thursday, November 05, 2009 4:47 PM
    •  
  • Thursday, November 05, 2009 2:57 PMManuel Altermatt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hey Daniel,

    Hmm... [slap on the forehead]... if you can't change the game, change the rules, haha. Great idea. I guess I was looking for a nice and "legal" way to do it, but you're absolutely right. Why not quickly change the status of the SLA while I perform the change.

    I'm going to give it a shoot. Thanks a lot for your answer and great blog by the way. I love how you juggle with LookUps and Picklists!
    manuel_altermatt@hotmail.com
  • Thursday, November 05, 2009 4:47 PMDaniel Cai Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Manuel,

    You are very welcome. Hope it has helped.

    Cheers,
    Daniel Cai | http://danielcai.blogspot.com