locked
How do I access a field of another form to link it to another form? RRS feed

  • Question

  • I have a form that is "joined" (I seriously have no idea what these are in English) to another form. This another form has a field that is filled with a number. I need to access this number in Javascript code, so I need the field in this form I have the JavaScript code executed against, right? So I need the field to get linked info from somewhere. I only seem to be able to make 1:N and N:1 and N:N relationships, how do I make 1:1 relationship so that it is nothing but a display in this form? I tried with 1:N relationship, the result is that there's a lookup selector to selected some entity to the field which is definitely not what I want.

    To show with a small example:

    Customer is linked to Order

    Customer has a CustomerName

    How do I print the CustomerName to Order form (without being able to edit it) (instead of an editable field that asks me to select a Customer as a CustomerName - as you see, the datatypes doesn't even match, not even close)?

    Friday, November 2, 2012 1:34 PM

Answers

  • Hi,

    you can create the same workflow as an "On-Demand" process. Then you can go to the grid containing the records, select them all and then click on the Ribbon button "Run Workflow" and run your workflow. After you do that, you can delete the "On-Demand" workflow if you don't need it anymore and only keep the automatic workflow.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    • Proposed as answer by Pavlos Panagiotidis Monday, November 5, 2012 11:20 AM
    • Marked as answer by KilpAr Monday, November 5, 2012 12:31 PM
    Monday, November 5, 2012 11:20 AM

All replies

  • you can create silverlight web resource to achieve this requirement, see below links for the same..

    http://blogs.msdn.com/b/crminthefield/archive/2011/02/07/showing-related-information-in-a-crm-2011-form.aspx


    MayankP
    My Blog
    Follow Me on Twitter

    Friday, November 2, 2012 3:06 PM
    Answerer
  • Hi,

    You can add a field (CustomerName) on Order form and fill that field with CustomerName with javascript, you make a relationship 1:N for you know what is the Customer.

    After the user choose the Customer, you can fill via Javascript the CustomerName.

    If you need help to do that tell me because i can put some code here.

    Hope this helps.

    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    Friday, November 2, 2012 3:09 PM
  • Hi,

    I'm not sure I understand your requirement correctly. You have an "Order" entity and a "Customer" entity. The order entity has a relation to a customer. So why doesn't the 1:N relationship work for you? A customer can have many orders, can't he?

    And then you mention that you need a field form the related customer to be displayed on the order form.

    I would suggest the following: create a 1(customer):N(order) relationship. Then create the field you need on the order form (Customer Name). After that, you can create a Workflow that updates the "Customer Name" of the order form each time an order is created or each time the Customer is updated. In this workflow you can add an "Update Entity" step, in which you can update the Customer Name field with the field from the related customer.

    If you don't want it to be editable you can disable the field. You can also hide the lookup field on the form if you want to.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Friday, November 2, 2012 3:17 PM
  • Hi,

    I'm not sure I understand your requirement correctly. You have an "Order" entity and a "Customer" entity. The order entity has a relation to a customer. So why doesn't the 1:N relationship work for you? A customer can have many orders, can't he?

    And then you mention that you need a field form the related customer to be displayed on the order form.

    I would suggest the following: create a 1(customer):N(order) relationship. Then create the field you need on the order form (Customer Name). After that, you can create a Workflow that updates the "Customer Name" of the order form each time an order is created or each time the Customer is updated. In this workflow you can add an "Update Entity" step, in which you can update the Customer Name field with the field from the related customer.

    If you don't want it to be editable you can disable the field. You can also hide the lookup field on the form if you want to.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Yes, one Customer can have many Orders, so yes, it is actually 1:N relationship. This workflow part is clearly the one I miss, I thought that it would be a lot easier to link a simple value to a form than linking one whole entity there.
    Friday, November 2, 2012 3:32 PM
  • Hi,

    You can add a field (CustomerName) on Order form and fill that field with CustomerName with javascript, you make a relationship 1:N for you know what is the Customer.

    After the user choose the Customer, you can fill via Javascript the CustomerName.

    If you need help to do that tell me because i can put some code here.

    Hope this helps.

    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    I think that would help. The main part I need help with is that how do I point in JavaScript to another form? Actually, this would be the closest of these three solutions to what I'm after (since I have actually no need to have the CustomerName displayed on the form, I just need it to a JavaScript code, but I thought it is much easier to bring in first to the form I need it in and then from there to code than directly to the code).
    Friday, November 2, 2012 3:35 PM
  • you can create silverlight web resource to achieve this requirement, see below links for the same..

    http://blogs.msdn.com/b/crminthefield/archive/2011/02/07/showing-related-information-in-a-crm-2011-form.aspx


    MayankP
    My Blog
    Follow Me on Twitter

    Thanks for the link, I'll definitely take a look at it!
    Friday, November 2, 2012 3:35 PM
  • Hi,

    I'm not sure I understand your requirement correctly. You have an "Order" entity and a "Customer" entity. The order entity has a relation to a customer. So why doesn't the 1:N relationship work for you? A customer can have many orders, can't he?

    And then you mention that you need a field form the related customer to be displayed on the order form.

    I would suggest the following: create a 1(customer):N(order) relationship. Then create the field you need on the order form (Customer Name). After that, you can create a Workflow that updates the "Customer Name" of the order form each time an order is created or each time the Customer is updated. In this workflow you can add an "Update Entity" step, in which you can update the Customer Name field with the field from the related customer.

    If you don't want it to be editable you can disable the field. You can also hide the lookup field on the form if you want to.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Yes, one Customer can have many Orders, so yes, it is actually 1:N relationship. This workflow part is clearly the one I miss, I thought that it would be a lot easier to link a simple value to a form than linking one whole entity there.

    Keep in mind that using the workflow approach you don't have to program anything yourself.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Friday, November 2, 2012 3:40 PM
  • Hi,

    I agree with Pavlos with workflow you dont have program anything.

    If you create the 1:N relationship you dont need point the javascript to another form. You just need catch the event changed of lookup field of customer and make a query via Javascript to know what you want from customer, because you have the id of that customer via lookup field. But if you want just the name of customer you can do fieldname.name (for the text of control) or fieldname.value (for the guid). 

    If you already have the customer you can build the lookup like that:

    Lookup lClient = new Lookup();
    lClient.Value = new Guid(entity.customerid.Value.ToString());
    lClient.type = EntityName.account.ToString();
    order.ret_clienteid = lClient;     

    Hope this helps.

    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    Friday, November 2, 2012 4:08 PM
  • Ok, now I have created a workflow, which updates the CustomerName field on the Order entity, which seems like a good option for the future. The problem is that I have now tons of orders that are "outdated" i.e. doesn't have the value there yet. Can I run the workflow somehow against the pool of orders so that each and every order gets the customer name filled to there? 
    Monday, November 5, 2012 11:15 AM
  • Hi,

    you can create the same workflow as an "On-Demand" process. Then you can go to the grid containing the records, select them all and then click on the Ribbon button "Run Workflow" and run your workflow. After you do that, you can delete the "On-Demand" workflow if you don't need it anymore and only keep the automatic workflow.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    • Proposed as answer by Pavlos Panagiotidis Monday, November 5, 2012 11:20 AM
    • Marked as answer by KilpAr Monday, November 5, 2012 12:31 PM
    Monday, November 5, 2012 11:20 AM
  • Hi,

    you can create the same workflow as an "On-Demand" process. Then you can go to the grid containing the records, select them all and then click on the Ribbon button "Run Workflow" and run your workflow. After you do that, you can delete the "On-Demand" workflow if you don't need it anymore and only keep the automatic workflow.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    This did work just like that, thanks a lot!
    Monday, November 5, 2012 12:32 PM