CRM Dynamics 2016 : using Javascript need to get an account id by phone number - dynamics-crm-2016

using Javascript need to get an account id by phone number , i realize that it can be done using Web API but i can't find any examples after searching.

Here's a reference page you can start from https://msdn.microsoft.com/en-us/library/gg334279.aspx, if you have done it using the REST API in 2013 it looks as if it's done in a similar way.

Here is the URI that you're looking for:
[Organization URI]/api/data/v8.2/api/data/v8.1/accounts?$filter=telephone1 eq '"+ phoneNumber +"' or telephone2 eq '"+ phoneNumber +"' or telephone3 eq '"+ phoneNumber +"' or mobilephone eq '"+ phoneNumber +"' &$select=accountid"
telephone1, telephone2, telephone3 and mobilephone are the types of phone numbers that exists in Dynamics. If you have custom fields on account entity, add it as a filter.

Related

How to update email address using 3 service providers - ORACLE

I have a table 'EMPLOYEES' where the users have an incorrect email address.
I need to update the email address using 3 service providers like gmail, yahoo, outlook. I have a large number of records so I can't do it one by one.
How can I write that query to update them all at once.?
In the email column, each record must have a valid email address
The first record in my table in the email field is sking. After update it should become jusking#yahoo.com it should only take one domain not all 3 together.
The second record should be nkochhar#gmail.com
The third party ledhaan#yahoo.com
And so it should be with each record, one of the three domains must be added to make it a valid email address.
sking#gmail.com
nkochhar#yahoo.com
ldehaan#outlook.com
name4#yahoo.com
name5#outlook.com
name6#yahoo.com
name7#yahoo.com
name8#outlook.com
name#gmail.com
name#gmail.com
...
I found this on Google but I don't know how to apply it to what I need:
for (int i = 0; i <rowsCount; i ++) {
cv.put (column2, columnValue [1]);
cv.put (column3, columnValue [1]);
db.update (tableName, cv, null, null);
}
I tried to do this but it shows an error:
I need help please, I'm a beginner at this :(
To update email field randomly with #outlook.com, #yahoo.com or #gmail.com use below query:
update employees
set email= (case when mod(employee_id,3)=0 then concat(email,'#outlook.com') when mod(employee_id ,2)=1 then concat(email,'#yahoo.com') else concat(email, '#gmail.com') end);
In both MySql and Oracle database this query will work fine.

Discord.js #everyone / #here issues with message

I have the code here for my embed announce feature, if a role is mentioned then it sends that role mention to the channel and then sends the rest of the message in an embed, i also have a variation for user mentions. How do i adapt this to do the same for #everyone & #here? they dont have ID's like roles. Either that or i cant find the ID of #everyone & #here. typing #everyone results in #everyone being returned, not an ID
if (args[1].startsWith('<#&') && args[1].endsWith('>')) {
message.channel.send(args[1])
const embed = new Discord.MessageEmbed()
.setTitle(`${(args.slice(2).join(" "))}`)
.setColor(0x320b52)
.setTimestamp()
.setFooter('Requested by ' + message.author.tag)
message.channel.send(embed);
Correct, #everyone and #here do not have IDs. Simply check whether either of them matches args[1].

Using Unity Facebook SDK 5.0.3, how can I get N random friends?

What would the FB.API call be to get 10 random friends? I am pretty sure this can be done with an fql query, but I do not know the exact syntax.
It would have the form:
FB.API(fqlQuery, Facebook.HttpMethod.GET, getNRandomFriendsCallback);
So my question, is what should fqlQuery be equal to?
I currently have it set to: string fqlQuery = "/fql?q={SELECT uid, name FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ) ORDER BY rand() limit 10 }";
But this returning 400 Bad Request.
Thank you.
You need to url encode your fql query since it's going over the wire as a HTTPS GET param:
var fqlQuery = "/fql?q=" + WWW.EscapeURL("SELECT uid, name FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ) ORDER BY rand() limit 10");
FB.API(fqlQuery, Facebook.HttpMethod.GET, getNRandomFriendsCallback);
fqlQuery would then look like this: /fql?q=SELECT%20uid%2C%20name%20FROM%20user%20WHERE%20uid%20IN%20(%20SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me()%20)%20ORDER%20BY%20rand()%20limit%2010
You can read more about Unity's url encoded method here:
http://docs.unity3d.com/Documentation/ScriptReference/WWW.EscapeURL.html

Is there an easy to use form to email with attachment for joomla?

I'm trying to build a custom form for a joomla website that allows users to complete some fields and attach a document that will be sent to an email address I can specify.
Does anyone know of any good components or plugins for accomplishing this ?
$from: This is the the email address that the email will look like it is coming from.
$fromname: This is the name of the person or organization this email is coming from.
$recipient: This is the email address (or array of email addresses) that the email will be going to.
$subject: This is the Subject of the email.
$body: The is the message body of the email.
$mode: Set this to 1 for HTML email, set it to 0 for text email. This field is optional.
$cc: This is the email address (or array of email addresses) that the email will be Carbon Copied to. This field is optional.
$bcc: This is the email address (or array of email addresses) that the email will be Blind Carbon Copied to. This field is optional.
$attachment: This is the full path and filename (or array of full paths and filenames) of the files that you wish to attach to the email. This field is optional.
$replyto: This is the the email address that the email will go to if the recipient clicks reply. This field is optional.
$replytoname: This is the name of the person or organization this email will go to if the recipient clicks reply. This field is optional.
Now that you know how that works, let's look at an example!
$from = 'admin#somewhere.com';
$fromname = 'BIGSHOT Blog';
$recipient[] = 'john#somewhere.com';
$recipient[] = 'jane#somewhere.com';
$subject = 'Want to learn about BIGSHOT Blog';
$body = '<p>Check us out!</p><p>http://www.somewhere.com</p>';
$mode = 1;
$cc = 'bob#somewhereelse.com';
$bcc[] = 'simon#somewhereelse.com';
$bcc[] = 'nick#somewhereelse.com';
$attachment[] = '/home/my_site/public_html/images/stories/food/coffee.jpg';
$attachment[] = '/home/my_site/public_html/images/stories/food/milk.jpg';
$replyto = 'no_reply#somewhere.com';
$replytoname = 'NO REPLY - BIGSHOT Blog';
JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);
You can use JUtility::sendMail to send an email in Joomla with attachment.For more information how to use go to this link.
JUtility/sendMail
A little more digging on the joomla extensions directory and I think I found what I need: http://extensions.joomla.org/extensions/contacts-and-feedback/contact-forms/11494

MVC3 Range validation when value is larger then zero

I have a product order page where the minimum order is 2500. I want to use the Range annotation validation in the model to validate this, but I also need the user to be able to select 0 of this product if they don't want any.
Now I use:
[Display(Name = "Item1")]
[Range(1000, int.MaxValue, ErrorMessage = "You need to order minimum {1} of Item1")]
public int OrderedItem1{ get; set; }
Is there an easy way to accomplish this without creating a custom validator?
Yes, you could use the regular expression validation attribute.
[RegularExpression(#"SomeRegExpression", ErrorMessage = "Min order error")]
I found out that I could do this using this regular expression validation attribute:
[RegularExpression(#"^(?:0|\d{5,}|[1-9]\d\d\d)$", ErrorMessage = "You need to order minimum 1000 of Item1")]
Thanks to Ryand Johnson for helping out.

Resources