Convert Order into custom entity 'X' - dynamics-crm

Issue is :
I have one system Entity called 'Order' and another custom entity 'X'. I am looking for some kind of same functionality as available on Quote called 'Convert into Order'. I want the same functionality on Order form that there will be some button on it and when i click on it, it will create instance of entity 'X' and not only this, it will also transfer all the mapping attributes of Order and 'X', on the 'X' form.
Can any one share his experience or step to implement this?
Many thanks.

You would have to use JavaScript and call CRM web services on click of new button.
So you don't have to map your attributes of your entities in JavaScript, you could use InitializeFromRequest to achieve same result. I have used this way to programmatically qualify/disqualify leads and convert them to contact, account and opportunities.
There is a nice sample code for this on CodePlex:
http://www.codeproject.com/KB/cs/CRM_30___EntityMoniker.aspx
Please note, this code has a bug. Check Ronalds post for quick fix:
http://ronaldlemmen.blogspot.com/2008/09/convert-lead-to-contact-account-andor.html

Yuo could do this using an on demand triggered workflow. just create a workflow targting the order entity, have the first step create a new entity X by copying the valuses from the passed in order entity.
if you want the option to do this to show under the more actions menu instead of teh workflows one then you can edit the isv.config file.

Related

Record without adding to repository?

Imagine creating a new QTP project. You hit record to get your first bit of code in place. By default, you'll get something like:
Browser("MyApp").Page("MyPage").WebEdit("MyLogin").Set "Bob"
And you'll get the Browser, Page, and WebEdit objects automatically added to the repository. What I would like to be able to do, as one of those QTP bods that prefers descriptive programming, is hit record, and get something like:
Browser("name:=MyApp").Page("name:=MyPage").WebEdit("name:=MyLogin").Set "Bob"
And have no objects added to the repository. Is there a setting / option to do this somewhere?
(Obviously there are arguments for not wanting to do this, which I acknowledge and appreciate - but for those of us that prefer DP, this could help expedite test creation).
From what i understood is that you want to hit 'Record' button and you will get the script in descriptive type rather than the usual. But that is not possible.
For descriptive programming, you have to explicitly write the code by identifying the properties of each object for that (you can use Tools > Object Spy).
For above example:
Go to Object Spy > Select "the pointing hand symbol button" and click on the WebEdit for which you want to set the text "Bob"
Now, from Object Hierarchy select each object Top to Bottom and write properties of those object in the script. Like 1st Browser, then Page, then WebEdit. Try adding as more properties as you can.
You just can not get descriptive script by hitting Record button.

Drupal Commerce Order object extra data

How might it be possible to get Commerce-Product-Display information in a Commerce-Order object?
The issue is I need to publish a Commerce-Product-Display node when a user has made a payment to publish the node. I am using Rules to detect the payment and attempt to publish the node.
My problem is, because the Completing the checkout process Rules event only has data for a Commerce-Order, and the Commerce-Order does not have information for the Product nor the Product display, I am unable to publish the node.
OK, so here's my new answer based on the new info you provided in your question
=================================
So this is probably a little more complicated than you expected, but not impossible! Two things are important:
the line-items that are attached to your order will contain your products and
you will need to use a rule component, in order to be able to have an additional 'condition-action' combo inside your rule action
Here is how to do it:
In your rule that is triggered upon 'Completing the checkout process', add a loop in your 'Actions' section. You should see 'Add loop' right next to 'Add action'. We'll use this loop to iterate through all the commerce-line-items in your order: that's where the products are hiding
When configuring the loop, tell it to iterate through 'commerce-order:commerce-line-items' and either rename, or remember what it's going to call each line item as it goes through it.
Now - as it's going through each of your order's line items, we'll want to call an entire new rule with its own set of 'condition' and 'action'. The condition we need is to check that the line item contains the product you expect, and the action can be whatever you want - publish a node based on a certain field or whatever. In my case, the action will just be sending an email to prove I found a product. When we need condition-action sets within a rule, we need to create a rule component!!
Go to /admin/config/workflow/rules/components to create a new rule component to run for each of the above items. Click the 'Add new component' link at the top of the page
Select 'Rule' from the drop-down options, since this will be a component that contains both a condition and an action
Name the rule, and in the 'Variables' section, we have to let it know we're going to pass it a parameter to work with. In our case, it will be the commerce line item that is currently being iterated through.
Add two conditions to your component (or whatever checks you think are necessary). I added 'Entity is of type' => Commerce Line item and 'Entity has field' => commerce_product. So this runs for all my products at the moment.
The condition I set on my component is to send an email, and I filled in the following for the body of the email: [line-item:commerce_product], and it prints out the product's name beautifully in the email each time I've tested checking out!
But first - how do I call this component for each of my line item types after I save it?? Read on:
After the component is saved, Add an action to your loop:
From now on, at the very bottom of your actions, you'll see a brand new 'Components' section, and in your case, you should only have one now. Select it to call it for each item:
Last step will be to fill in the parameter to pass to this component, which is obviously the list_item you're currently on, or whatever the computer name of the current item was if you changed it.
Save and test!
Whew! It's a little complicated, but I hope it puts you in the right direction!
The way rules work in Drupal is that not all fields are shown for your entity by default in the actions. What you need to do is prompt Rules to recognize your object as a certain type of node in order for the Rule to add all of its appropriate fields.
You can do this either by
using the 'Content is of type' under the Node section check (and select your Commerce Display node type or
directly using the 'Entity has field' check under the Entities section to check for a specific field you want to use.
Either of those should prompt Rules to recognize the type of entity you're working with and populate the Actions with the necessary fields.
Let us know if this works!

Sitecore: Retrieve user input during event or..?

I would like to add functionality to the Sitecore Content Editor. I want to perform some action when a developer adds an item through the content tree. I understand I can create an event handler (e.g. OnItemCreating) which all works. The problem is I need user input at this point. By at this point I mean OnItemCreating, so the input needs to be there before the item is created.
Are events capable of retrieving user input? If so: how? If not: any suggestions on a solution for the above?
I believe you can achieve this with a Command Template. Chapter 4 of the Data Definition Cookbook (PDF link) describes how you write these commands.
You can extend a pipeline (for instance, uiAddFromTemplate or uiDuplicateItem) with your own processor which prompts for the user input and handles it. See <processors> section in web.config for more details.

How to add components in to an existing GUI created by guide?

I just created a GUI using guide in MATLAB for a small project I'm working on. I have amongst other things two text fields for from and to dates. Now I'd like to get rid of them and use a Java date select tool. Of course this is not possible using guide so I need to add them manually.
I've managed to get them to show up by putting this code into my Opening_Fcn,
uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');
using UICOMPONENT.
But even though it shows up I can't access the date select's attributes, for example
get(handles.til2)
returns
??? Reference to non-existent field 'til2'.
How can I fix this?
Unless you edit the saved GUI figure, the basic handles structure will not include your new component by default.
One way to access you component is to store the handle via guidata, by adding the following to your opening function:
handles.til2 = uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');
guidata(hObject,handles)
Functions that need to access the handle need the line
handles = guidata(hObject)
to return the full handles structure that includes the filed til2

MS CRM 4 - Custom name for entity lookup link

When I have a custom entity Referral, the primary attribute is a refid and this is what shows up in associated views (as the link text that opens Referral form). I need to change this name to something that is generated from entity attributes). Something like:
Referral.ToString() { return ref.id + " " + ref.first_name + " " + ref.last_name + " "; }
instead of the default ref.id.ToString() -- or however it works.
Is this possible via the MS CRM 4? I fear it might not be (having clicked through the gui customizations for a while), but maybe I missed something.
If not, what is the most elegant way of doing this? A javascript function would need to be somewhere global (otherwise it would need to be copy+pasted to every form/view that mentions Referral). Also, the javascript function (I assume), would need to do at least one additional XmlFetch on every view.
Any suggestions, comments, ideas welcome. I've started modifying the MS CRM at work and I keep hitting issues that I feel have been solved by open source python web frameworks over and over again. Please help a poor soul at work :)
I've found the easiest way of handling this is to populate the primary attribute with the fields you want concatenated. You can do this in javascript on the form, a plugin registered to fire on create and on change of any of the attributes you want, or a combination of both.
Unfortunately, there's no (supported) way to change the primary attribute after create of an entity. You'd have to recreate the entity with something like prrfix_name as the primary attribute, and then combine your id, first_name, and last_name fields.
Trying to alter CRM's behavior re: displaying the primary attribute would be completely unsupported, and probably pretty technically daunting and take a huge chunk of time. I'd just take the time hit to recreate the entity with a new primary attribute.

Resources