Sage CRM 7.2: How to add 'New Person' link/button to Enbu CRM Resource Planner screen

Hi,

I'm very new with Sage CRM development and now, I'm trying to achieve to put a button on Customer entity screen.

When you go to 'Communication' -> 'New Appointment', there's 'New Person' link on screen which when you clicks it, it will pop up another screen for you to create a new person record.

I'm trying to put that 'New Person' link on Enbu CRM Resource Planner screen.

I noticed Person field on Enbu screen is using the same database field as 'New Person' link on 'New Appointment' screen (cmli_comm_personid). So, I'm thinking that may be, somehow, we can change javascript code of Enbu screen to be the same as 'New Appointment' screen.

Any advise would be highly appreciate.

Thank you.

Cheers,

  • 0

    Hi,

    You can add new Person button on Custom Entity screen. To do the same follow below instructions.

    1. Create dummy field in your custom entity and add this field on the Custom entity screen.
    2. In Create script of the dummy field write below code:

    var sURL=eWare.URL(1231)

    var sKeyIndex=sURL.indexOf("/eware.dll");

    var sNewURL=new String(sURL);

    var sServerName=sNewURL.substring(1,sKeyIndex)

    Caption=""

    Caption+="

    "

    Caption+=""

    Caption+="New Person"+""

    3. In Custom content of the Custom screen write below code which will open popup to create person.

    function OpenPersonWindow()

    {

    var hdnPersURl=document.EntryForm.hdnPersURl.value;

    hdnPersURl+="&ViewField=,Pers_FullName,Pers_PhoneFullNumber,&JumpReturnCol="

    hdnPersURl+="&JumpIdField=Pers_PersonId&JumpNameField=Pers_FullName&"

    hdnPersURl+="SearchEntity=Person&SearchTable=vSearchListPerson&SearchSql=&searchsqld=&"

    hdnPersURl+="SsDef=20&LinkedField=&"

    hdnPersURl+="TiedField=&SearchText=&PopupWin=Y'"

    var CompWindow = window.open(hdnPersURl,'WebPickerNew','scrollbars=yes,resizable=yes,width=700,height=600')

    }

    In above code instead of “” write person field name which is created in your custom entity to hold Person value.

    Hope this helps!

    Regards,

    Dinesh

  • 0

    Hi Dinesh,

    Thank you for your reply. That's help a lot and it works.

    One more thing, after pop up new person screen, would it be possible to default firstname & lastname retrieved from custom entity screen?

    For instance, we have 2 fields, cmli_firstname & cmli_lastname, in custom entity screen and when new person screen pop up (I added dummy field in custom entity screen), it will pick up those 2 fields and default them on create person screen.

    Thank you very much.

    Regards,

    Chayaporn

  • 0

    Hi,

    Yes, you can pass the values in query string of popup as follows.

    hdnPersURl+=”pers_firstname=”++”&pers_lastname=”+

    Once this value is passed on URL, same can be collected on Person screen and client side code needs to be written to put the same in corresponding fields.

    Regards,
    Dinesh

  • 0

    Hi Dinesh,

    Thank you for your reply.

    I put the code in as below:

    function OpenPersonWindow()

    {

    var hdnPersURl=document.EntryForm.hdnPersURl.value;

    hdnPersURl+="&ViewField=,Pers_FullName,Pers_PhoneFullNumber,&JumpReturnCol=cmli_comm_personid"

    hdnPersURl+="&JumpIdField=Pers_PersonId&JumpNameField=Pers_FullName&"

    hdnPersURl+="SearchEntity=Person&SearchTable=vSearchListPerson&SearchSql=&searchsqld=&"

    hdnPersURl+="SsDef=20&LinkedField=&"

    hdnPersURl+="TiedField=cmli_comm_personid&SearchText=&PopupWin='Y'&"

    //new code

    hdnPersURl+=”Pers_firstname='firsttest1'&Pers_lastname='lasttest1'”;

    var CompWindow = window.open(hdnPersURl,'WebPickerNew','scrollbars=yes,resizable=yes,width=700,height=600')

    }

    However, the new person screen didn't pop up. When I remove that new code, it popped up again. May be I put it to the wrong place.

    Would you please advise where should I put it in?

    Thank you very much. Really appreciate your help.

    Regards,

    Chayaporn

  • 0

    Updated:

    Those code works. Thank you so much Dinesh ^^

    Now, I'm facing new problem. On new person screen, I put this code in Create Script:

    var strLastname = Values("pers_lastname");

    DefaultValue = strLastname;

    But it didn't work. Even I tried -> DefaultValue = 'Test' . There's nothing in pers_lastname field.

    Any idea??

    Thank you.

    Regards,

    Chayaporn

  • 0

    Hi,

    Yes, you are right, I too tried to set default value to Last Name field but no success. But I have found an alternate way for the same. As you are using Sage CRM 7.2, there is a Client Side API function named getArg(argument,url). This function returns querystring value from URL. Using this function you can get firstname and lastname values which you are passing in url. Once you get values just set them to the fields. Following is the code for your reference. Just copy this script in custom content section of the screen.


    crm.ready(function () {

    var sFirstName=crm.getArg("Pers_firstname",crm.url());
    if(sFirstName=="" || sFirstName=="undefined" || sFirstName==null)sFirstName="";

    $('#pers_firstname').val(sFirstName);
    });

    Hope this helps!

    Regards,
    Dinesh

  • 0

    Hi Dinesh,

    That's absolutely great work!!!!

    Thank you very much. :)

    Regards,

    Chayaporn