locked
How to Show Create Button In Custom Child Entity of Active Contract?

    Question

  • I have a custom entity that is related to Contracts, with this relationship I can see and create new custom entities in the left panel of the Contract Entity and that works fine, naturally.

    I need to be able to change status of Contract to Active, and be able to continue creating new child entities, but the "Create" button in the associated Views of all entities that are related to Contract dissapear.

    Is there a way to enable this?

    Thursday, July 1, 2010 8:45 PM

Answers

All replies

  • Are you trying to enable Create button for inactive record's associated view?
    Daniel Cai | http://danielcai.blogspot.com
    Thursday, July 1, 2010 8:56 PM
  • Hmm that would depend on our understanding of inactive . For example, in a Quote, if you go to Actions-> Activate Quote, internal Status of the quote changes to "Active" and is not possible to edit any fields. Same happens when a Contract is in "active".

    So the "parent", in this case, contract or quote, are Active , but if I look at the associated views of my custom entity (or any other entity) from the Quote or Contract Window, the "Create" buttons above the associated view dissapear.

    I need to be able to keep creating instances of my custom entity even the parent is in Active state.

     

    Thanks.

    Thursday, July 1, 2010 9:09 PM
  • OK, you are right, I don't deal with Contract entity much, so I was not interpreting Active status correctly. I was talking about general CRM entity's Active/Inactive status. 

    I plan to write a blog post about how to do this if you are patient enough. It is not tremendous effort, but I am just currently occupied. You will have it within a few hours, how does that sound? 


    Daniel Cai | http://danielcai.blogspot.com
    Thursday, July 1, 2010 9:20 PM
  • Sounds perfect!! Thanks a lot!
    Thursday, July 1, 2010 9:37 PM
  • Please check my blog post for complete script and the instruction about how to use it. 

    Hope this has helped. 

    Cheers!


    Daniel Cai | http://danielcai.blogspot.com
    Friday, July 2, 2010 12:45 AM
  • Wow, Thanks a lot Daniel!  It works perfectly!

    It was great help indeed!!

     

     

    Monday, July 5, 2010 4:04 PM
  • Now I have another question related to this code... is it too difficult to match this code with CRM Roles so that it only shows the button to users with the proper Create privileges over the custom entity?

    What would be the steps to make this work? In any case if it's too complicated I think i could survive restricting the viewing of the "Save" button once the entity's form is displayed.

    Thanks again!

    Monday, July 5, 2010 4:54 PM
  • It's quite complicated to get the privileges implemented correctly, since it involves at least 3 privileges, including the Create and Append privileges of the child entity, Append To privilege of the parent entity.

    So I would leave it as simple as it currently is, and I believe CRM platform will not actually save the record if the user doesn't have all the privileges. Give it a try, I am pretty confident that CRM platform will do the right job. :-)

    Cheers,


    Daniel Cai | http://danielcai.blogspot.com
    Monday, July 5, 2010 5:04 PM
  • Thanks Daniel, I'm not sure if I should put this question in another thread, but I think it may be solved with a very similar hack as the one you  posted for my initial question.


    Is it possible(probably with just a small modification to your code?) to Hide the "Create CustomEntity" and "Create Existing CustomEntity" from the associated view? I need the user to have permissions to create the entity, and be able to view it, BUT the creation of this entities is made only inside a plugin, and I shouldn't allow the user to view the form for "creation". As I use it just as visualization.

    Thanks


    Monday, July 12, 2010 11:12 PM
  • Hi,

     

    i have followed this hack to show a "create new" button  in child entities(posted above in this thread). Now i have followed this other turorial(also posted in this thread) to hide "add existing xxx" button. The problems is that when i used both scripts in a form's onload event, the hack that adds the "create new" button does not work(the button is bever showed).

    Any idea?

    Cheers

     

    Friday, August 13, 2010 4:11 AM
  • Hi,

     

    i have followed this hack to show a "create new" button  in child entities(posted above in this thread). Now i have followed this other turorial(also posted in this thread) to hide "add existing xxx" button. The problems is that when i used both scripts in a form's onload event, the hack that adds the "create new" button does not work(the button is bever showed).

    Any idea?

    Cheers


    Make sure that you have supplied correct parameters. 
    Daniel Cai | http://danielcai.blogspot.com
    Friday, August 13, 2010 4:16 AM
  • Hi,

     

    The parameters are correct, what i think the problem is, is that both scripts overwrites the "loadArea" function. So if you want both scripts to work, you will need to consider wich of those overwrite functions use, you can merge them or something.

     

    I did kinda merge and it worked perfectly.

     

    Cheers

    Friday, August 13, 2010 4:40 PM
  • Good to know it worked. 
    Daniel Cai | http://danielcai.blogspot.com
    Friday, August 13, 2010 4:57 PM