restrict customer lookup to contacts bug - dynamics-crm

I'm using microsoft dynamics crm 4
I inserted the following line to restrict a customer lookup to contacts only (no accounts):
crmForm.all.customerid.setAttribute("lookuptypes", "2");
It does restrict the lookup to contacts only, but there is a strange bug:
When i select any customer, the icon next to him becomes the account icon, not the contact icon (folder instead of card)
Any solutions to this ?

Here is the answer:
var customer = crmForm.all.customerid;
customer.lookuptypes = "2";
customer.lookuptypenames = "contact:2";
customer.lookuptypeIcons = "/_imgs/ico_16_2.gif";
customer.defaulttype = "2";
Posted by Andriy a33ik Butenko, in reply to my question on the msdn dynamics forum.

Related

How to update budget name , amount and biddingStrategyType of Campaign budget in Google AdWords API?

I already have a campaign budget which i want to update using google AdWords API.
BudgetServiceInterface budgetService =
adWordsServices.get(session, BudgetServiceInterface.class);
// Create a budget, which can be shared by multiple campaigns.
Budget sharedBudget = new Budget();
sharedBudget.setName("Interplanetary Cruise #" + System.currentTimeMillis());
Money budgetAmount = new Money();
budgetAmount.setMicroAmount(50_000_000L);
sharedBudget.setAmount(budgetAmount);
sharedBudget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
BudgetOperation budgetOperation = new BudgetOperation();
budgetOperation.setOperand(sharedBudget);
budgetOperation.setOperator(Operator.ADD);
// Add the budget
Long budgetId =
budgetService.mutate(new BudgetOperation[] {budgetOperation}).getValue(0).getBudgetId();
// Get the CampaignService.
CampaignServiceInterface campaignService =
adWordsServices.get(session, CampaignServiceInterface.class);
Assiging budgetId to campaign
Budget budget = new Budget();
budget.setBudgetId(budgetId);
campaign.setBudget(budget);
This will unassign existing campaign budget and assign new campaign budget to the campaign ( campaign budget is not removed and it still exist in google ads) but I want to update the budget name and budget amount of existing campaign budget rather than assigning new campaign budget.
Use BudgetService to do it. you can find more details in the documentation
$budget = new Budget();
$budget->setBudgetId(BUDGET_ID);
$budget->setStatus(BudgetBudgetStatus::REMOVED);
$operation = new BudgetOperation();
$operation->setOperand($budget);
$operation->setOperator(Operator::SET);
$operations[] = $operation;

Google Sheets - Dependent drop-down lists

I am recreating and expanding on a doc I had previously made. I have already brought in the script I had used originally, and tweaked it where I believed appropriate to get it working in this sheet, but I must have missed something. Editable samples of the 3 spreadsheet files involved can be found here. These files are a sample "Price List", "Catalog"(which aggregates manufacturer names from all price lists, and also has a "Catalog" tab for misc items not sold by one of my primary vendors), and "Addendum B" which is the file I require assistance with.
This document is an addendum to my contracts which lists all equipment being sold as part of that contract. It has 2 sheets in it ("Addendum B" and "XREF"), and "Addendum B" has several dependent columns: Vendor, Manufacturer, Model, Description, and Price. Their dependencies are as follows:
Currently Working
Vendor: Basic data validation pulling from XREF!A2:A.
Not working, script in file
Manufacturer: Based on the Vendor selected, should be a drop-down
list generated from the column headed with that vendor's name on
"XREF".
Now here's were it gets tricky beyond what I had previously done.
Model: I want this column to be a drop-down listing all model numbers
associated with that manufacturer, from a completely separate price
list provided to me by my vendor. (I have shared a sample price list which reflects column positions as they appear in all such files.
Description: Displays the corresponding description for the Model selected, from the price list selected in the Vendor column.
Price: Displays the corresponding markup price for the Model selected, from the price list selected in the Vendor column.
And that about summarizes my goals and what I'm struggling with.
So I looked into your script file in sheet Addendum B.
I have made few edits and it should be working now, the modified code:
function onEdit()
{
var ss = SpreadsheetApp.getActiveSpreadsheet(),
sheet = ss.getActiveSheet(),
name = sheet.getName();
if (name != 'Addendum B') return;
var range = sheet.getActiveRange(),
col = range.getColumn();
if (col != 6) return; //You col was set to 5 changed it to 6!
var val = range.getValue(),
dv = ss.getSheetByName('XREF'),
data = dv.getDataRange().getValues(),
catCol = data[0].indexOf(val),
list = [];
Logger.log(catCol)
for (var i = 1, len = 100; i < len; i++) // Problem is here, you have too many items in list! Cannot have more 500 items for validation
list.push(data[i][catCol]);
var listRange = dv.getRange(2,catCol +1,dv.getLastRow() - 1, 1)
Logger.log(list)
var cell = sheet.getRange(range.getRow(), col-1)
var rule = SpreadsheetApp.newDataValidation()
.requireValueInRange(listRange) // Use requireValueIn Range instead to fix the problem
.build();
cell.setDataValidation(rule);
Logger.log(cell.getRow())
}
The reason your validation was not working was you had more than 500 items in your data validation list. I just modified it to take the same values from range instead. Hope you find that helpful!
Now for the remaining 3 questions, here are my comments and thoughts on it:
1) I didn't find any code related to the problem you mentioned in your question. So, I am gonna assume you are asking for general ideas on how to achieve this?
2) You basically approach the problem the same as you did with the above code! Once a manufacturer is selected, the script looks for that manufacturer in the sheet and update the Data validation in the corresponding model column.
You will modify the code like so
var ss = SpreadsheetApp.openById("1nbCJOkpIQxnn71sJPj6X4KaahROP5cMg1SI9xIeJdvY")
//The above code with select the catalog sheet.
dv = ss.getSheetByName('Misc_Catalog')
//The above code will open the Misc_Catalog tab.
3) A better approach would be to use Sidebar/Dialog Box to validate your input then add it to the sheet at the end. (Looks Cleaner and also prevents unnecessary on edit trigger in the sheet, which can take a while to update.)
You find more details here: https://developers.google.com/apps-script/guides/dialogs

Google Calendar API Returning multiple events with similar Event IDs

I am getting events from the Google API through the event feed as follows
Dim EventFeed As EventFeed = mservService.Query(EvtQuery)
Dim EventEntry As EventEntry
For Each EventEntry In EventFeed.Entries
sEventID = EventEntry.EventId
Next
The EvtQuery.Uri = https://www.google.com/calendar/feeds/thisistheprivatecalendarname/private/full?max-results=10000&start-min=2014-01-14T10:14:23-07:00&start-max=2014-02-14T10:14:23-07:00
This seems to work great and is returning all of the events. However, I am also getting some events returned that are NOT on the calendar when I look at it...
Examples as follows...
EVENT ID Event Title Visible on Calendar
o8jji0o7v85gmsihabus2igo78 Joe smith TRUE
p61tspg9or4aovnhmpoc1jh87o_20140115T230000Z Joe smith (every other week) FALSE
8rmipc7ko7rbdrsvuev8al32q4_20140115T211500Z HOLD (monthly) TRUE
8rmipc7ko7rbdrsvuev8al32q4 OPEN (3 of 4 wks) FALSE
These appointments come through as having the same date and time. Why would I be getting appointments that do not show on the calendar?
Thanks!

Populating DataGrid in Visual Studio from Access Database?

I have a datagrid in my form. What I did was I made an OleDb connection to my database in access, then I made a dataset in my project and put my Food table in that. Then on the page that contains the form, I added a dataset (dataset11) from the Data Toolbox that links to dataset1.xsd in my project. I then put the data source on my datagrid to dataset11.Food (Food being the table I want to display). This adds the two fields in that table to the datagrid (id and size) but none of the data I put in in access shows up! There are 15 entries in this table but they don't show up on my datagrid even when I run the program. What am I doing wrong???!?!!?!?!?
Here is a picture: http://i39.tinypic.com/2rr43yf.png
Edit added code from external link
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("Tag", Me.Dataset11, "Food.Size"))
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("DataSource", Me.Dataset11, "Profile.ProfileName"))
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("DataMember", Me.Dataset11, "Profile.ProfileName"))
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("Visible", Me.Dataset11, "Profile.ProfileName"))
Me.DataGrid1.DataMember = ""
Me.DataGrid1.DataSource = Me.Dataset11.Profile
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(296, 8)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(384, 256)
Me.DataGrid1.TabIndex = 12

Dynamics CRM 2011 Once-off Bulk Update test records with random values

A thousand records are created in MS CRM Development Environment instance. A new field is required and is created by entity customization. We need random value in each record in that field. What are the supported ways to achive this?
Options I thought about are
Workflow (does not allow random value)
Bulk update (does not allow random value)
Bulk update with import from excel after adding a random value colum populated with =RAND(). Not sure if this will update existing records.
Writing an ODATA web resource html page to do this. (too fragile, long development and debug time and effort)
Using LinqPad 4 with CRM 2011 connector plugin to achieve the same
The following solution in LinqPad 4 with CRM connector took 10 minutes to process around 700 records.
//set up a random amount generator
var r = new Random();
//initialte with an arbitrary value
decimal amount = 13;
//list all required records using linq
var ats = (from at in psm_assettypeSet
where at.psm_Amount.Equals(null)
select at).ToList();
//check count
ats.Count().Dump();
//check
(ats.First() as psm_assettype).psm_Amount.Dump();
//loop through
foreach (psm_assettype at in ats)
{
//calculate amount
amount = (decimal)r.Next(31);
//check
amount.Dump();
//set amount, use XRM class properly
at.psm_Amount = new Microsoft.Xrm.Sdk.Money(amount);
//update object in memory
UpdateObject(at);
}
//bulk update all records
SaveChanges();
//check success
(ats.First() as psm_assettype).psm_Amount.Value.Dump();

Resources