I extract from an WebService several Products which I convert to ProductModel, however, some of these products are "variants".
I need to manually convert a ProductModel to VariantProductModel, is there any OOTB way to achieve this ?
You cannot change an object from Type. This is partly because the datatype is tied into the PK of your object.
If you want to change the type, you will need to create a new instance of the variantProductModel, copy all the fields and remove the original product
Related
I want to create a Custom field type in share point online.It should allow me to create column using that data type.The datatype will be a calculated column and should provide results as Progress bar,stars and others.Whether its possible to do?I don't want to go for JSLink and others as it need to be dynamic one through out the site collection
SharePoint online doesn't support custom field type as on-premise.
You may check SPFx field customizer.
I have a site powered by ExpressionEngine 2.5.x, using Freeform, integrated to post form data to MS Dynamics CRM 2011. The extension is nicely scalable, I can change the mapping, all that excellent stuff. My problem is how to find mapping values for Lookup fields in MS Dynamics.
I am trying to map form fields from the site forms, into MS Dynamics. Some of the fields are Lookups, in MS Dynamics. Our mapping calls out the numerical value of the Lookup item, rather than its name. (Which is good, because ppl can change the text names in the MS Dynamics console without breaking the mapping.)
My question is: I know how to find the actual back-end field names of form fields within MS Dynamics. But how to I find the numerical values of the picklist items and lookup fields? Say I have a Lookup field, for Lead Source (called campaignid). The items are:
web
online
radio ad
flyer
word of mouth
other
I know that when I edit options in an option set, I can see their numerical value. Where can I edit options in a lookup field? I've tried looking under Settings > Customizations > Customize the System, but didn't see anything called lookup.
Lookups are pointers to entities. They do not have numerical values like regular option sets. So I guess that you will have entity called Campaign (or lead) so you can check which campaigns exist in the crm DB where each entity will have view in the DB.
Let's see if i understand your question. You don't have a Lookup option like Option Set because a lookup is consequence of a relationship 1:N between two entities. So for edit a lookup you need edit a record of a entity. In lookup fields you don't have numerical values, you have guid that represent individually a record, so in a record a lookup is stored in database as a guid. Check this video.
Check here how find this guid with the record open.
A look-up field is, roughly speaking a pointer to en entity (in C# it's referred to as EntityReference instead of Entity) and it consist mainly of a guid and logical name of something.
Usually, in the code, when you have an entity, in order to access the fields of its lookup-connected entity, you'll need to make an extra query for that.
So, if you have a Contact instance and need to see the address of its parent customer, you'll have to get the guid and logical name (in this case it'll be Account) and retrieve the data for it separately.
EDIT:
Suppose that you have created an instance of Contact entity and you'd like to access its lastName field. Then you can simply refer to it as follows.
var value = Xrm.Page.getAttribute(“lastName”).getValue();
On the same form, there's also a field that refers to an Account instance (its name is parentCustomerId. Suppose now that you'd like to get the fullName field of the Account. One could expect the following to work.
var account = Xrm.Page.getAttribute("parentCusomterId").getValue();
var name = account.getAttribute("fullName").getValue();
However, that's not going to work, because the parentCutomerId is a look-up field. It means that it only contains a guid (a pointer, a reference) identifying an other entity. You'll have to use it (the guid) in order to fetch the instance that the look-up is "mentioning". Then you'll be able to check it's properties.
I have a sharepoint list, for example it is named as SourceList. I also have several lists which are associated to SourceList via lookup fields. I don't know the names or number of these lists\ they are created and being created dynamically. And any time a new list associated to SourceList can be created.
So, how can i get the lists associated to SourceList programmatically by Sharepoint object model? I know that i can iterate through lists and also the fields of the lists to check if it is a lookup field and associated to my SourceList. I don't want to do this for performance concerns but it will be my last chance if i can't find a better solution. And also i know i can query sharepoint db directly to get these lists but i will never want to do this.
Thanks.
You basically just need to access the list then the lookup field which should be of type SPFieldLookup when you have this object the source list will be the LookupList property on that field.
They have a good example in this link:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldlookup.aspx
I have two Sharepoint lists - ListA and ListB.
ListA has columns productName, productType. ProductType is made of choices (TypeA, TypeB, TypeC). Each product must belong to only one type. He gives Product Name and ProductType(from Selection) during adding products to ListA. ListB has columns RequestName, RequestDate, ProductName. ProductName is simply lookup to the ListA.
In ListB while adding new item,I first want to select productType and then display products of this type only. But, I couldn't find any ways to do this. Is there any way to do this, even programmatically.
OR alternatively, actually I don't need productType information in ListB. I am making workflow that uses ListB and that starts automatically when I add requests to ListB (he selects productName, and give RequestName and RequestDate). Then, in workflow, I have to check if the productName is of typeA or typeB or typeC, since I need this productType information to make some decisions in Workflow. Is there any way to get productType information from only productName using ListA and ListB.
Since this productName is unique, in Sql, it would be something like this
select productType from ListA where productName="selectedProduct"
but I have no clue if I can do some query in Lists in SP and get this result, store it in variable and use this later on.
Thanks
Note : For someone interested in cascading lookups in Sharepoint using Infopath forms, look here http://blog.libinuko.com/2010/07/21/sharepoint-2010-how-to-create-cascading-lookup-field/
If you have medium to advanced programming skills, you can achieve this by creating a custom field type. The basics are outlined in this article: http://msdn.microsoft.com/en-us/library/gg132914.aspx
Basically, a custom field type is made of:
an xml file defining the field name, properties and some other settings
a class inheriting from SPField (this is the actual field)
a field control (this is what you see on the new/edit listitem forms)
a field editor control (this is what you see when you create or modify the field, where you set the field properties)
a field value class
Some of those components are optional. In your case, you'll probably want to create a field that inherits from SPFieldLookup and create a custom field control and a custom field editor control. There's no need for a custom field value class, since you'll use the SPFieldLookupValue class.
A quick search on Google (or the search engine of your choice) can give you lots of detailed information and tutorials about the art of creating custom field types.
I would suggest using one of the cascading lookup fields available as 3rd party products, such as this one (i admit, this one is made by our company). Then you can have your product name column filtered by the Product Type column. No custom development required, you will just need to make some small changes to your lists (such as create a Product Types list and look it up, instead of using a choice column)
old problem now getting new. Anyone has a good idea for storing currency values in a sharepoint list? Problem is - there is a currency field, but it is not multi-currency enabled.
I could obviously store the value in two fields (currency lookup from a list, value in second field), but I take it as wondering whether there is a more viable approach that.
You could create your own custom field type
Custom Field Type
Building Custom Field Types in Windows SharePoint Services 3.0