ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 2 replies, has 2 voices, and was last updated by oro_newbie oro_newbie 1 year, 1 month ago.

  • Creator
    Topic
  • #21664
    oro_newbie
    oro_newbie
    Participant

    Hi,

    I have a particular case where I have created an extended field for Case Entity let’s say the field is for storing the Invoice no. issued to the customer. The practical scenario would be that the case is related to a particular customer (account) and for that invoice no. (which is why the invoice no. is an extended field).

    The aim is to populate all the invoice numbers of the customer once the related Account is selected. I can get the invoice numbers through the Account ID using ajax and populate the extended select field with those values. But on saving, after I select a value, I get an error saying “The value is not valid”. Most probably because the select box was empty in beginning.

    So what’s the correct way to load dynamic values in an extended select field and have it stored?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #21726
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi,

    As i understood you have relations Account -> Case -> [Extended Select Invoice Numbers field], on some event, do you populate this select with many invoices ?
    Can you show me how do you populate ?

    But on saving, after I select a value, I get an error saying “The value is not valid”.

    Do you save case ? Can you explain more detail?

    #21730
    oro_newbie
    oro_newbie
    Participant

    Hi Mike,

    I used a workaround to solve my problem but to explain you better, here’s what I was trying to do:

    1) I created an extended field in case entity – let’s say invoice_no
    2) Made the type as ‘Select’ and left the options empty:

    3) This field depends on Account entity. Anytime an account is selected in Case create page, since the account ID has a one-to-many relation with Invoices table (invoice_account_id), it needs to load all the invoice_no of that account ID.
    4) I can get the invoice numbers by passing the account ID on change event of relatedAccount (in Case create page). I noticed that you have used the select-2 javascript plugin for the select boxes and was able to populate the invoice numbers inside the

    elements from which the select-2 gets the values.
    5) But when I save the case after selecting the newly populated values I get the error like I explained to you. I think this is because my select options were empty in step 2 and only the values that I place in the entity management page are valid.

    I’m sorry I don’t have the code for the above now since like I said I used a workaround. Here’s what I’m currently doing.

    1) I created an extended entity field invoice_no but this time made it of String type
    2) On the case create page, I first hide the invoice_no textbox (css – visibility: hidden) and instead insert a empty select box in its place
    null
    3) On selection of account (relatedAccount field), I use ajax to get all the invoice numbers of that account and populate them in the select box created above.
    4) Whenever the user selects an invoice number from the select field, I store that value in the visibility hidden input.
    5) So now when it gets saved, the ID of the invoice number is what’s saved in the extended field invoice_no.

    I’m sure there must be a “Oro” way of handling such kind of dynamic values for extended fields but currently the workaround is what I’m doing.

    Thanks in advance.

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

You must be logged in to reply to this topic.