• Resolved luisdavh

    (@luisdavh)


    Hi, I was trying to add a metadata to erp_people.

    It create at the first moment with erp_people_update_meta function. Then, I try to get the metadata but the system automatically deleted. I use the function erp_people_get_meta.

    I have checked the database, and is at the beginning, then is deleted.

    Could you please tell me what I am doing wrong ?

    Thanks !

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello @luisdavh

    It’s really tough to say why this is happening unless knowing the whole scenario and the codes you wrote to add the metadata.

    If you can describe what you are trying to do and share your codes, we can review it.

    Thanks

    Thread Starter luisdavh

    (@luisdavh)

    Hi! Thanks for your reply.

    After create a Contact, I want to add a custom metadata to the Contact, so I used the actions:

    add_action(‘erp_create_new_people’, ‘custom_function’ );
    add_action(‘erp_update_people’, ‘custom_function’ );

    Then, inside of the function I need to add the custom metadata of the Id assigned from our own application, so I used this:

    erp_people_add_meta( $wperp_contact_id, ‘id_custom_app_id_user’, 1598433, true );

    So, it added to the custom meta, because I saw in the database, however after I refresh the CRM, or go to the contact, it disappear. Looks like a function is deleting.

    I have used this function, adding to the Google plus metadata, and it worked fine, no function is deleting.

    erp_people_update_meta( $wperp_contact_id, ‘googleplus’, 1598433);

    After do that, I can refresh, go to the contact and is not deleted. So, I conclude some function is deleting the metadata. Should I need declare first ?

    Thanks for your help !

    Hello @luisdavh

    The way you have tried is working for us! Not sure what is wrong happening to you.

    Anyway, try this if it helps

    add_action('erp_create_new_people', 'custom_function' , 10 , 3 );

    function custom_function( $wperp_contact_id, $args, $type ){
         erp_people_add_meta( $wperp_contact_id, 'id_custom_app_id_user', 1598433, true );
    }

    Thanks

    Thread Starter luisdavh

    (@luisdavh)

    Hi !

    Yes, you are right, it creates the Metadata. However, is only to show, then try to edit and save again, and look for that metadata and I cannot find it. They system auto delete.

    I just tried again.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Metadata’ is closed to new replies.