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

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";

Related

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...)

How do I change the default quick form for the CustomerId field in 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.

TFS API - Why is the AllowedFieldValues for 'Reasons' empty?

I'm trying to retrieve the list of valid Reasons for a WorkItem (MS Agile 5 template), which works correctly for a new work item.
However for editing existing work items, the AllowedValues is always empty, whatever the state.
WorkItem item = GetItem(...)
item.Fields["Reason"].AllowedValues.ToList() // always empty
(ToList is my own extension method).
The problem is, the Visual Studio UI correctly updates the Reasons list when you change the state in the drop down list.
The Reason field also has IsLimitedToAllowedValues=false but when you enter an arbitary value it complains that it's not a valid list item.
We also use MS Agile 5 & the following worked fine on an existing work items named myWorkItem (I tried with User Story & Task):
FieldDefinitionCollection fdc = myWorkItem.Type.FieldDefinitions;
Console.WriteLine(myWorkItem.Type.Name);
foreach (FieldDefinition fd in fdc)
{
if(fd.Name == "Reason")
{
AllowedValuesCollection avc = fd.AllowedValues;
foreach (string allowedValue in avc)
{
Console.WriteLine(allowedValue.ToString());
}
}
}

Siebel - How to get all accounts of an employee with eScript?

how can I get all accounts of am employee?
In the "Siebel Object Interaces Reference" I found an example, how to get all industries of an account:
var myAccountBO = TheApplication().GetBusObject("Account");
var myAccountBC = myAccountBO.GetBusComp("Account");
var myAssocBC = myAccountBC.GetMVGBusComp("Industry");
So I would like to do something like:
var myEmployeeBO = TheApplication().GetBusObject("Employee");
var myEmployeeBC = myAccountBO.GetBusComp("Employee");
var myAssocBC = myAccountBC.GetMVGBusComp("Account");
But I get an error
Semantic Warning around line 23:No such predefined property Account in class BusComp[Employee].MVGFields.
I can see in Tools that there is no Multi Value Link called "Account" in Business Component "Employee", so I can actually understand the error message.
So I wonder how I can get all accounts of an employee.
I found the Business Component "User" which has a Multi Value Link to "Organisation" and another link "User/Account".
Is this what I am looking for?
How can I know? Where is documentation which tells me about the semantics of links? (Is this described in "Siebel data model reference"? I cannot download this document, although I have signed in...) This link could also link a user to the organization it belongs to.
If one of these links IS what I am looking for, what would be the way to go to get the "User" Business Component of a corresponding "Employee" Business Component?
Many questions of a Siebel newb...Thanks for your patience.
Nang. An easy way to approach this (and to learn it) is to figure out how you'd do it in the UI. Then move onto figuring out how to do the same thing in script.
When you say, "get all account of an employee," do you really mean get all accounts where a particular employee is on the account team? In the UI, that would be done by going to: Accounts > All Accounts Across Organizations, and querying for that specific user in the "Account Team" multi-value field.
From that same view, go to Help > About View in the application menu. You'll see in the popup that the view uses the Account business object and the Account business component. A quick examination of the applet you queried on will show you that the "Account Team" field on the applet is really the "Sales Rep" field on the Account business component. Here's how to mimic what we did in the UI, in script:
var boAccount = TheApplication().GetBusObject("Account");
var bcAccount = boAccount.GetBusComp("Account");
bcAccount.SetViewMode(AllView); // like All .. Across Orgs
bcAccount.ClearToQuery();
bcAccount.SetSearchSpec("Sales Rep", "NANG");
bcAccount.ExecuteQuery();
Then you can walk through the list of accounts and do something with each one like this:
// for each account
for (var bIsRowActive = bcAccount.FirstRecord();
bIsRowActive; b = bcAccount.NextRecord())
{
// do something here
}
I hope you're enjoying Siebel.

Domain Services submit problem

I have some simple forms in silverlight 4 using WCF RIA RC2 Domain Services.
All of my forms appear to be working great, I went with the traditional code behind for granular control and formatting.
The problem I am having is on one particular form the data isnt being updated unless I update one of the other fields.
Here is my code.
void ConfirmSave_Closed(object sender, EventArgs e)
{
if ((bool)ConfirmSave.DialogResult)
{
_New = false;
tblEmailTemplate Selected = (tblEmailTemplate)lstEmailTemplates.SelectedItem;
Selected.Name = txtName.Text;
Selected.Description = txtDescription.Text;
Selected.Body = txtBody.Text;
Selected.ModifiedBy = Security.DomainUserName;
Selected.ModifiedOn = DateTime.Now;
Selected.Body = txtBody.Text;
DataStore.SubmitChanges();
Dialogs.ConfirmationDialog Added = new Dialogs.ConfirmationDialog(Selected.Name + " has been saved.", "Email Template Saved");
Added.Show();
lstEmailTemplates.ItemsSource = DataStore.tblEmailTemplates;
lstEmailTemplates.DisplayMemberPath = "Name";
}
}
If I type a change lets say append an 'A' to each field, Name, Description, Body - all 3 get updated.
NameA
DescriptionA
BodyA
But if I dont make a change in description, Body is not updated.
NameAB
DescriptionA
BodyA (Should have been BodyAB)
If I only make a change into Body its not updated.
If I only make a change into Name it is updated.
This is very wierd behavior. Tracing the code down through the domain service I see the changed record having the correct changes - as far as the old record it just contained the ID and everything else was null, this is probably by design but I dont spend much time debugging the domain services layer.
Any ideas?
I had a bug like this with Check Boxes in RC1, this bug was actually in the selection changed code. A good reason to adopt the data binding techniques RIA offers.