How do I change the default quick form for the CustomerId field in Dynamics CRM 2013? - dynamics-crm-2013

The CustomerId field that comprises both the Account and Contact records defaults to the Contact Quick Form when creating new records from a Lookup field of that type.
How can I get the field to instead default to the Account Quick Form?

I encountered the same request from a client recently and after some unsuccessful searches we decided that we replace the field on the Form with Account field. Even though there is a Customer filed, there are 2 seperate fields to store Account and Contact by default in CRM.
Therefore we just removed/hid the customer field on the form and added the Account field. Once you populate the Account field, the customer field gets automatically populated.
Hope this helps.

This is what I've done to set up the Customer lookup to show only Contact records.
function Form_OnLoad()
...
preFilterLookup();
..
}
function preFilterLookup() {
Xrm.Page.getControl("customerid").addPreSearch(addLookupFilter);
}
function addLookupFilter() {
document.getElementById("customerid_i").setAttribute("lookuptypenames", "contact:2:Contact");
document.getElementById("customerid_i").setAttribute("lookuptypes", "2");
}
In case you want to add a filter to the records:
function addLookupFilter() {
document.getElementById("customerid_i").setAttribute("lookuptypenames", "contact:2:Contact");
document.getElementById("customerid_i").setAttribute("lookuptypes", "2");
var account = Xrm.Page.getAttribute("aux_account").getValue();
if (account != null) {
var filter = "<filter type='and'>" + "<condition attribute='parentcustomerid' operator='eq' value='" + account[0].id + "' /></filter>";
Xrm.Page.getControl("customerid").addCustomFilter(filter);
}
}
So, the changes I've done to migrate from CRM 2011 to 2013 are:
Add _i when you get the element by: document.getElementById("customerid_i")
Use new methods: addPreSearch and addCustomFilter
You can check these in msdn documentation and easily change code to show only Accounts.

Related

google app maker link fields of related records

I am attempting to set a field in one data model to equal to a field in a related data model. I've considered setting up an event to set the field equal to the other but do not know what the best trigger for this event would be and do not know the code that would be required.
Additionally, perhaps an event is not needed and there is some more fundamental/basic way to establish this field connection between related models.
Example: People Model has Companies Model as a related model. When adding a new People record, selecting the related Companies record would mean that the "Industry" field in the People record would be equal to the "Industry" field in the related Companies record.
Thank you!
You can execute a callback function after the People record is created. The callback function would change the Industry field value of the related Companies record to match the same value of the People record. Something like this (GIF). Notice that I am updating the Companies Industry value while creating a People record.
Here's the code on a Client Script:
var pgPeople = app.pages.PeopleCompanies;
var pgPeopleDesc = pgPeople.descendants;
function updateRelatedRecordField(){
var peopleDatasource = app.datasources.People;
peopleDatasource.createItem(function(record){
var industry = record.Industry;
record.Companies.Industry = industry;
});
}
You need to replace the default onClick function on the Form widget button with your function updateRelatedRecordField();
Read more here.

create new user account manually on prestashop

I am developing a module that get user data in a page , I wand to submit this data to prestashop database to create a new user account .
so how can I do this ?
how should I understand what data I should get from user Like email,phone number and etc . (I want to know this Shop get what data from user to sign them up).
thank you
You can use this piece of code to create a Customer.
$customer = new Customer();
$customer->firstname = 'John';
$customer->lastname = 'Doe';
$customer->email = 'johndoe#gmail.com';
$customer->passwd = md5(pSQL(_COOKIE_KEY_.'yoursecretpasswordhere'));
$customer->save();
Like Madhi said, you will get all information needed for the Customer in Customer.php
Cheers :)
All the things you need are defined in the "classes/Customer.php" file.
Each PrestShop class has one "public static $definition" and each field of the $definition that has the "'required' => true", is required

Transaction BODY Field from COLUMN Field (Netsuite)

I have an issue where some of our orders are being imported directly into Netsuite, and there is information from the first line item, that I need to copy into the transaction record (i.e. custom field on sales order)
I want to set this up so that it is automatic, I don't have access to the system that is used to bring the orders into Netsuite, and I only JUST got suitescript access and everything I read about that is way above my head..
I know basic HTML and some of the scripting formulas from Netsuite and that's all.
I was hoping there would be a CUSTOM FIELD FORMULA or some other similar way that I can just easily source the information directly from the first item in the item sublist?
This would be quite trivial to implement using SuiteScript. The example below assumes you want to copy the Memo field (description) from the first line item to the body Memo field. The basic idea would be something like the below (untested code):
function userEventBeforeSubmit(type){
if (type === 'create') {
var record = nlapiGetNewRecord();
var memo = record.getLineItemValue('item', 'memo', 1);
record.setFieldValue('memo', memo);
}
}
If want to accomplish this via custom fields etc. it is possible using "Custom Fields with Values Derived from Summary Search Results".
To do this create a Saved Search as follows:
Type: Transaction
Criteria: [none]
Results: Formula (Text), Summary
Type = Maximum, Formula: DECODE({line}, 1, {memo}, NULL)
Available Filters: Internal ID
Then create a Custom Transaction Body Field as follows:
Type: Free Form Text
Store Value: F
Validation & Filtering > Search: [Saved Search from previous step]
As this is a dynamically calculated field (Store Value = F), it would be available when viewing the record, but not in Saved Searches and lists. To remove this limitation, you can create a Workflow that would copy this field to another one that is stored.

How to Fetch custom column value from Sharepoint 2010 user group

I have created an user group in SP 2010 and i have added one custom column to it, from the list settings.
How to get the custom column value in web part?
EDIT:
My custom column is District. I want to return that column value in visual web part application.
To return group users i use this code
List<SPUser> users = SPContext.Current.Web.SiteGroups["PDO Owners"].Users.ToList();
I assume you mean you created a custom property for the user profile as in my opinion you cannot add extra columns to user groups. You can get the values through the ProfileManager object doing something like this:
//GET THE USER PROFILE MANAGER
SPServiceContext sc = SPServiceContext.GetContext(site);
UserProfileManager userProfileManager = new UserProfileManager(sc);
//GET A PROFILE FOR A USER
UserProfile profile = userProfileManager.GetUserProfile("i:0#.f|fbamembershipprovider|myfbauser");
string propertyvalue = profile["propertyinternalname"].Value.ToString();
Depending on the type of field, you will have to use something else than ToString (eg for a managed metadata field i think you should use TaxonomyFieldValue, etc...)

CRM 2011/2013. stopping header displaying "new contact" or "new property" etc

In CRM 2013 and 2011 I have some data that I've imported in. When you view the records they have, at the top in big letters "New Contact" or "New Account" etc depending on their type. I've looked at the form header and tried adding a field there (that I want displayed) thinking that it defaults to to new whatever since there is no other field. This is not the case. Primarily I'm using 2013, but the same thing happens in 2011 as well.
I tested to see if it's just for the imported records, but it also happens when I create new ones. Is this something that CRM does usually, and if so is there a way to tell it to display something else?
I believe what you're asking about is the way CRM displays the name of the Entity in the page title and the form header. If so, this is a (completely unsupported) function that I call to update the name of an entity in CRM 2011. I'm guessing it won't work for 2013 though.
setDisplayName: function (name) {
// Updates the Document Title
var title = parent.document.title;
var start = title.indexOf(':') + 2;
var end = title.lastIndexOf('-') - 1;
parent.document.title = title.substring(0, start) + name + title.substring(end);
// Sets the div Name
document.getElementById("form_title_div").childNodes[2].childNodes[0].innerText = name;
},
You can call it on the onLoad of the Entity and clear it, or set it to whatever you like.
What OP wanted was to remove the New Case label when creating a new Case (or any other entity)
I've done this today in CRM 2013 with this line
//Remove New Case label
document.getElementById("FormTitle").style.visibility = "hidden";