JScript to automatcally set Regarding on an appointment, possible?

Hello,
I have been trying to figure out how to accomplish this:
I would like to on an appointment set the Regarding(regardingobjectid) field with the parent account of the contact (or account) selected to the Required (requiredattendees). The script would run on the OnChange-event of the required field.
I am able to get the fields to polpulate with data that lies inside the current record but cannot quite figure out how to manage to get the data from the related record of the Required-field. Is it possible, surely it has to be?
I have been looking into web pages on REST, I suppose that is the way to go, but as I said, I haven't managed to figure it out quite yet.
Does anyone have links or tips that would help to figure this out?
Br,
Janne

Dear Janne,
Try below code :
function SetRegardingObjectId () {
var requiredattendees = Xrm.Page.getAttribute("requiredattendees");
if(requiredattendees.getValue() !=null)
var RequireAttendessType = Xrm.Page.getAttribute("requiredattendees").getValue()[0].entityType;
if(RequireAttendessType =="contact")
var serverUrl ;
if(Xrm.Page.context.getClientUrl)//Post UR 12
serverUrl = Xrm.Page.context.getClientUrl();
else//Pre UR 12
serverUrl = Xrm.Page.context.getServerUrl();
var requiredAttendeesId = requiredattendees.getValue()[0].id;
var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
var oDataFilter ="/ContactSet?$select=ParentCustomerId&$filter=ContactId eq guid'" + requiredAttendeesId + "'";
var userRequest = new XMLHttpRequest();
userRequest.open("GET", ODataPath + oDataFilter , true);
userRequest.setRequestHeader("Accept", "application/json");
userRequest.setRequestHeader("Content-Type", "application/json; charset=utf-8");
userRequest.onreadystatechange = function () {
if (this.readyState == 4) {
if (this.status == 200) {
var retrievedRecords = JSON.parse(userRequest.responseText).d;
if(retrievedRecords.results.length > 0)
var parentaccount = retrievedRecords.results[0];
var lookup = new Array();
lookup[0] = new Object();
lookup[0].id = parentaccount.ParentCustomerId.Id;
lookup[0].name = parentaccount.ParentCustomerId.Name;
lookup[0].entityType = parentaccount.ParentCustomerId.LogicalName;
Xrm.Page.getAttribute("regardingobjectid").setValue(lookup);
userRequest.send();
else
var lookup = new Array();
lookup[0] = new Object();
lookup[0].id = requiredattendees.getValue()[0].id;
lookup[0].name = requiredattendees.getValue()[0].name;
lookup[0].entityType = requiredattendees.getValue()[0].entityType;
Xrm.Page.getAttribute("regardingobjectid").setValue(lookup);

Similar Messages

  • Automate the set regarding option in CRM 2013 in Outlook?

    Is there a way to configure the Outlook add-in for CRM 2013 to automatically set regarding on incoming emails, to the parent account, from contacts who are already in CRM?  Customer is asking for automated regarding, not just tracking.
    Thank you!
    June

    Did you ever find a solution to this issue? I have seen this in a development environment as well.

  • Why is it when you set a calender event in outlook 2010 (in UK) with a reminder alarm for 30mins prior) and have the iphone set to keep the appointment time relative to the local country time that you travelled to, the alarm time is still at uk time ?????

    why is it when you set a calendar event in outlook 2010 (whilst i am in UK) with a reminder alarm for 30mins prior to the appointment time) and have the iPhone set to keep the appointment time relative to the new country time that i have travelled to (this works OK), the alarm time is still relative to the UK time and not in sync with the local country time like the main appointment is.
    Does anyone know the answer please.

    This has to do with the Time Zone Support selected in your phone. If you check in Settings>Mail, Contact, Calendars, there is a setting for Time Zone Support at the bottom of the page under Calendars. If that is turned to off, the calendar should support the local time. Because time is set to Automatic (since you say the time is correct on the iPhone), it is reflecting the local time. That information comes from the carrier, not the iPhone itself. You can check, however the iPhone says that if you turn off the Time Zone support, it should reflect in the local time. Do a test, if possible,  and see if that will do what you are asking.

  • CRM Outlook Client - Set regarding throws an error

    When I switch from the Account entity to other entities in the Set Regarding (Look Up Record) I get an error:
    An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.
    It´s in a CRM 2011 UR 18 environment + Outlook 2010/2013. This error happens to all users even though I tried given a test user a system admin privileges.
    The script error I get is this:
       <Message>Unable to get property 'Success' of undefined or null reference</Message>
       <Line>670</Line>
       <URL>/_controls/lookup/lookupinfo.aspx?LookupStyle=single&browse=0&enableRemoveBtn=1&objecttypes=1%2c2%2c3%2c112%2c1010%2c4402%2c10000%2c10014</URL>
       <PageURL>/_controls/lookup/lookupinfo.aspx?LookupStyle=single&browse=0&enableRemoveBtn=1&objecttypes=1%2c2%2c3%2c112%2c1010%2c4402%2c10000%2c10014</PageURL>
       <Function>anonymousr:Unabletogetproperty'Success'ofundefinedornullreference</Function>
       <CallStack>
        <Function>anonymousr:Unabletogetproperty'Success'ofundefinedornullreference</Function>
       </CallStack>
    I´ve tried trace logs on the server without much help + Diagnostics for Outlook give similar results as the script error above.
    Has anybody encountered this error before or similar?
    Regards,
    Ragnar

    Hi Ragnar,
        Can you verify that the version of the Outlook plugin you have is 5.0.9690.4376? This is the version for UR 18:
    http://support2.microsoft.com/kb/2958724
    If not, please download and uninstall your current version of the Outlook plugin, and reinstall with this version:
    http://www.microsoft.com/en-us/download/details.aspx?id=44265

  • HT1692 Set my outlook calender appointment for 7am but when i went to the west coast it changed my appontment to 4am on my i phone 4s

    Set my outlook calender appointment east cost time for 7am but when i went to the west coast it changed the appointmnet to 4am

    You have Time Zone support turned on. 4 AM on the west coast IS 7 AM where you were.  You need to specify the time zone for the appointment if it is different from the one you're in when you create it.

  • How to set default time for appointment

    When I had snow leopard, the default time for length of an appointment was one hour.  I upgraded to Lion and now the default time is many hours.  Can't seem to find the area to change the default.  Keith

    Hello User,
    Check this:-
    Sasi Nagireddy: How to Set Default Time Zone for all Users in OBIEE?
    Thanks,
    Sasi Nagireddy..

  • Setting rooms/resources for appointment through mail app

    Hi,
    Is there any way to set the rooms for an appointment through mail app, i know i can set the location field of appointment in compose mode. 
    I was wondering if there is any way to add/modify/remove rooms form appointment when outlook appointment is in compose mode? i have goggled it but did not fins any link which says the at it cannot be done. so just hoping if its possible
    Thanks

    Meeting rooms would be addressable entities just like a user/mailbox.  So you can create a Recipients object containing the required rooms using their email address and add them to the requiredAttendees property:
    Appointment.requiredAttendees property (JavaScript API for Office v1.1)
    http://msdn.microsoft.com/en-us/library/fp160965(v=office.1501401).aspx
    Eric Legault (MVP: Outlook;
    About me)
    Outlook Appins: Store social media fields in your Outlook Contacts!
    Co-author, Microsoft Office 2013 Professional Step-By-Step

  • Will Apple Genius Bar run Diagnostic tests on my computer or do I need to set up a special appointment?

    I got my Mac OSX with Lion about 9 months ago. Two months after I bought it, it crashed. Apple gave no direct explanation and ended up wiping the computer. Two months after that it happended again. That time they gave me a knew hard drive but they still didn't give me an explanation. Then recenty it crashed (kernal panicked) after I downloaded the thunderbolt application. That time apple was able to restore everything.
    Unfortunately, my computer is now showing many of the same symptoms (slow loading, safari freezing, applications needing to be forced quit...etc) as it did before it crashed the first two times. I should mention that when I say "crashed" I mean my computer wouldn't turn on again. Now I am afraid to turn my computer off or even let it go to sleep. I know this isn't good for it but I don't know what else to do.
    So my question is, will Apple Genius Bar run some diagnostic tests for me or give me a special lesson? Or do I need to pay for a special lesson? I just want a trained person to run some diagnostics and go through the basics of updating, shutting down, and restarting my computer with me. That way if anything goes wrong they see it first hand.
    One more thing, could it be something I am doing. I have downloaded Flash Player but only from the Flash website. But I have heard Flash/Mac problems. Or is there anything else I could be doing or downloading?

    With Apple you Always Need to Make an Appointment. Otherwise they will turn you away. Even if the place is empty.

  • Copy control setting regarding DN for STO

    Hi gurus,
    When I create outbound delivery note for cross-plant POs, the items cannot be showed in one D/N as the delivery date on the PO are different.
    When I change them to the same date, they can be showed in one D/N.
    The copy control configuration for the item is: 303 (item data for data transfer)
    I tried others item data choices and was still not right.
    I want to make the same POu2019s item in the same outbound D/N. How can I make it?
    Thanks in advance.

    Hi Subhasish,
    It's not just ZUKRI - it could be any field and since 011 does not form ZUKRI it isn't in your case. What I'd suggest is:
    1. Create your own Data Transfer Routine as a copy of 011.
    2. Assign it in VTFF.
    3. clear fields that create a split
    Also check partners, because the city code, must come from a partner which is assigned to the header. In case this is unwanted, assign this partner function to item procedure, rather than the header and you'll avoid the split.
    regards,
    Stratis

  • Customer service regarding credit card mishandling possible credit fraud

    To whom it may concern,
    On Tue morning I placed a order for a sprint prepaid galaxy s3 and a go pro hero package through the early black friday preview deal.  I had both items in my cart and checked out the go pro package with promo code.  I then immediatley went back into my shopping cart and proceed to put in my galaxy promo code and the item was not longer available and sold out.  I then called customer service to see about why this was removed from my cart and how I could order one.  I was told that item was sold out and nothing could be done.
    I then relealized in the confusion that I entered the wrong credit card in the system and wanted to change the form of payment to the correct card.  I was told that they will take my credit card information and I gave the CR rep my credit card and was put on hold.  I then was taken off hold and another CR rep was on the line and I started the whole process again giving my credit card information waiting for an authorization from her, which she gave me. (This whole process took approx 45 min by the way).
    I then get to work and decide to check the status of my order at best buy and I am suprised to see my initial credit card info was used to process the order, not the new credit card that was given and told authorized.
    I call CR again and the order was checked on on they said that the payment was authorized for the intial credit card and basically there is nothing I can do to change it.  I tell my story to the CR and she sees that I did request my credit card payment to be changed but can do nothing for me not even cancel the order and reissue it with my proper CC number.
    I ask to speak to a supervisor Angela and she again tells me their is nothing can be done with my order is being processed and by the original credit card was used as authorized.
    My major concern at this point is who did I give my credit card # twice too.  She tells me the agent I was speaking with and I demanded that we get connected with this agent to see what happened with my CC info.  She informs me that this can not happen.  I ask what as a supervisor is going to be done.  She offers no remedy for the multiply issues I was having.  I had to tell her that I would like to escalate this issue, she then said she can issue a ticket # 148428368.  I then ask for the call to be reviewed and I would like a transcript of the conversations I had with the CR rep and how it effects my credit card security.  I am posting this so this get rectified and more people are aware of the dangers your company practices of handling credit card numbers to the CR reps.  I feel this situation could of been handled much differently and want to hear a solution to my issues.
    Concered Customer,

    Hi wildwest99,
    I sincerely apologize if this phone agent didn’t handle your request to change your payment source as you expected them to. It sounds like they tried to change the payment source, thought it went through, but obviously it didn’t change.
    We would never give a copy of our recordings to a customer but we would cooperate fully with any ongoing police investigation. Has this second credit card been used without your authorization? If so, you need to contact the local authorities in order for them to open an investigation.
    I can say that many calls are reviewed and if this agent didn’t act appropriately action will be taken. This action will of course will be treated internally. Other than providing you a transcript of this call, or sharing if any action is taken in regards to this agent, is there anything specific you would ask of me?
    Thanks for posting,
    Allan|Senior Social Media Specialist | Best Buy® Corporate
     Private Message

  • Custom dDocTitle set value by Script, is possible ?

    Hi to all,
    I will like to know if is possible to set the dDocTitle by script, I tried the following code:
    <$var_01 = "Hola"$>
    <$var_02 = "_Mundo"$>
    <$titulo = var_01$ & var_02$>
    <$dDocTitle = titulo$>
    this code was set in a rule and defined to the field dDocTitle in the user default value option when the field is added to the rule
    Oracle Content server version 10g
    tnks

    It sounds like you want to use a default or derived attribute value.
    You set these in rules, which are applied via profiles.
    http://docs.oracle.com/cd/E23943_01/doc.1111/e10978/c04_metadata.htm#DAFIIEEI
    let me know if this helps!
    -ryan

  • Set amount of TV overscan - possible?

    I've got a Mini DVI -> s-video adaptor that I use to hook my macbook up to my old CRT TV to play videos. It works a treat, bar one thing: With overscan turned off, the picture is cut off a fair way inside the TV, but with overscan turned on it cuts off a fairly large amount of the picture.
    So my question is: Is it possible to set the amount of overscan for a given external display? Something between the two extremes of "none" and "cut off a quarter of the picture" would be great.
    I couldn't find anything in the display preferences, so I'm hoping there may be some magic plist-manipulation that I can do.
    - Ben

    Hi Kristen,
    You have the compare function implemented incorrectly.  You need to make sure that the first terminal of the "Greater than or equal" function connected to the output of the sum, and the second terminal to the tick count in the while loop.  The first terminal corresponds to x parameter and the second terminal is for the y parameter.  So if x is greater than or equal to y, then the loop will need to exit.
    You can see how long a subVI is taking if you put a flat sequence structure within your subVI around the entire subVI code.  The first frame would only have a tick count going into an indicator, the middle frame your normal code, and then the final frame would contain another tick count wired into another indicator.  Then you can subtract the second indicator value from the first and get hold long it took to execute the middle (core) of your code for that subVI.
    I highly suggest using the highlight execution and probes and other debugging techniques such as breakpoints to diagnose where the data is being held up.

  • TS2664 I'm having trouble setting up wireless file sharing possible Mac OS X 10.4 and OS X Mac OS X 10.7.3. Can anyone help?

    I have 2 macs hooked up on a verizon wireless network. Got a new mac mini with Lion when my "old"  Imac Intel core dou with tiger stopped working. However I had it repaired and now have both sharing the same wireless network. Since the old Mac was online previously it is set now as the administrator. Don't know if that is the problem but file sharing privileges a denied and Iv'e tried everything I know with my limited knowledge. Thanks for any advice.

    Once you get access to the public folder, you can drag aliases to the other folders to the public folder.
    command + l will make an alias you can then drag.
    Is there a reason the one is still at 10.4.3?
    What bdaqua means is that you may consider upgrading to 10.4.11.  Of course, there was some bug in 10.4.11 that may require you to reconfigure your wireless access. Just a hassles, wireless works fine in 10.4.11.
    Pick the appropriate combo update.
    http://support.apple.com/kb/TA24901
    I've had good luck with pureFTP for data transfer when the hassles of Mac OS got in the way of data transfer.
    You could use FTP.
    *Local Lan*
    I use pureFTP server.  It comes as part of PureFTPd Manager software download at this site.
    http://www.macupdate.com/info.php/id/12630
    PureFTPd Manager is the gui program manager for the pureFTP server.
    *Across the internet*  You do not need this.  I left it in from my standard post.
    Try:
    PureFTPd Manager. Free. Is the server. It runs on your home computer. I found PureFTP easier to use than the Apple solution in Tiger. The apple solution could have changed.
    You would have to contend with these issues:
    Enable your Mac firewall to pass ftp traffic.
    Do you have a local router? Enable it's firewall. Tell it to pass ftp data to your home mac.
    Verify that your isp lets you run an ftp server on your home mac.
    Dynamic ip address.  See
    http://www.dyndns.com/services/dns/dyndns/            ( Free )
    http://www.tzo.com/mainpagetext/DynamicDNSorStaticIP.html        ( small fee )
    One your laptop, run one of these ftp clients:
    http://discussions.apple.com/message.jspa?messageID=12753786#12753786
    Robert

  • Setting for 5ghz n only - Possible?

    Using TIme Capsule. Settings right now of n 2.4 and 5ghz Name st under Wirelss options.
    I have no need for the 2.4 side any longer, but do not see the ability for just a setting of N 5Ghz only.
    Not possible?
    Thanks

    Correct it is not possible.. Apple since introducing the dual band simultaneous model.. has no provision to turn off a wireless band..
    You can on older ones set it to G wireless.. just change the mode.. and fix it to the most out of the way channel you can.

  • Soo much trouble setting up NIS (and if possible AutoFS)

    Hi,
    I have recently started a company, and run an office with 4 workstations running ArchLinux and a server running Debian (Wheezy).
    Ultimately I want this out of the network:
    1. Centralised user accounts
    2. Centralised home directories (mounted over network)
    3. All users should be able to FTP in to the server externally, and reach all the files in their home directory.
    As of now I will be happy just to get NIS working. The homedirectories i can sync over the network with Rsync and then easily share via FTP with VSFTP. So far, I have followed these guides:
    http://www.server-world.info/en/note?os … _7.0&p=nis
    http://penguin.triumf.ca/recipes/nis-auto/
    NIS Problems:
    1. I cant get change passwords. If I run yppasswd on a client, I will get "segmentation fault (core dumped)". Somewhere I read that if you only have one master server, no slaves, you can only change passwords in the server. I tried using yppasswd locally, but that just results in "NIS not being able to change password"
    2. I want to have a seperate passwd and shadow file for NIS, so I was thinking of putting them in /var/yp/etc/, but will login through FTP work?
    General questions:
    1. Is it completely retarded of me to think i can get this working running ArchLinux clients? If so, what do you guys recommend?
    Please. I'm running on 12 hours with this shit now and I just find more and more errors. I need help.

    Set up another box running ArchLinux just to see if i could get it running...
    Followed the wiki on NIS, but I cannot start ypbind. I have up to starting the daemons, without problem. The make command runs fine, but i cannot start the goddamn ypbind daemon. Running systemctl status ypbind gives me.
    ypbind.service - YP Bind
    Loaded: loaded (/usr/lib/systemd/system/ypbind.service; disabled)
    Active: failed (Result: exit-code) since Wed 2014-01-08 22:47:11 CET; 7s ago
    Process: 492 ExecStart=/usr/bin/ypbind (code=exited, status=1/FAILURE)
    Journalctl -xn does not give me anything.
    Last edited by iOfWhy (2014-01-08 22:49:58)

Maybe you are looking for

  • Hard drive

    Hard drive failed, how can be fix

  • Need urgent help with RAID failure on Graphics server (running OSX10)

    Hey. Here's the deal... Our graphics department has a MAC G4 (fully upgraded. newest patches, OS, etc.) that's got a 4 port SATA RAID controller. They use this with four 750GB hard drives as an external RAID (the OS is on a seperate, 65GB hard drive)

  • Report - who is the current approver for purchase requisition

    Hi Experts Is there a report that can give information the status / who is the current approver for purchase requisition? currently if we open the PR directly, we can only know the release strategy, release code, status of approver, but we cannot hav

  • Lost ability to SSH & Ping without changing configuration

    Howdy - hoping someone with a bigger brain than I can help me figure this out. I had a problem with the recent storms wiping out my ADSL & phone line. The phone co. got my line and connection back up, and I can get outbound connections fine (e.g., em

  • Program similar to Ical

    Since I cant get Ical to work since the last update and cant seem to reinstall it from a disk I need to know if there is another program that works like Ical? I have tried all the different fixes on the discussion board and now seem to have a less th