Writing Javascript Code to support Multi-browsers - dynamics-crm-2011

I am new to CRM 2011 Javascript,Can anyone please suggest me in writing the below lines in CRM 2011 Javascript to support multi browsers please.
In IE it is working fine but not in other browsers
crmForm.new_schemaname.DataValue = crmForm.all.schemaname.DataValue;
I tried to write like this
Xrm.Page.getAttribute("new_schemaname").getValue() = Xrm.Page.getAttribute("schemaname").getValue();
Throwing error saying Can't assign to a function result

You need to use the setValue function
Xrm.Page.getAttribute("new_weightedpercentage").setValue(Xrm.Page.getAttribute("CFPoppStage").getValue());`
You'll probably also want to check for null values before blindly assigning and reading values...

Related

Method to clear pre-filled data of a ST.future.Component

Is there a way to clear an input field while using the ST.component("locator"); API?
Using ST.component("locator").setValue(""); results in the following error:
TypeError: ST.component(...).setValue is not a function...
PS: Is the old forum now permanently closed? Is there a way to view older questions?
Edit: Seems like the other forum was down yesterday, therefore the PS.
If it's an Ext JS field you will need to use the ST.field API in Sencha Test, which has a setValue method. This method isn't available on the more generic ST.component API.
ST.field('myfield')
.setValue('');
Or if it's a normal input field (not an Ext JS component), then you can do the following:
ST.element('#myfield')
.execute(function(field) {
field.dom.value = '';
});

How do I acquire and return the date using an AWS lamba function

I am a unity developer who has been hired to make a game on the amazon alexa. It has been a mostly smooth process so far, but I now need to call the day's date into my IDE (pullstring), and was told by pullstring support that the solution is to make an endpoint api call to a lambda function that I will create and host.
I have tried finding some basic tutorials along the lines of making a very basic lambda function, but most of the videos and tutorials I've found assume I am already a web developer and know my way around node js and amazon's service environment, which I do not.
The function that I need is simple enough (I think?), as I just need to call the current date as a number and then look up that date on a json I have set up (which is working, I just need to get the actual real date instead of a dummy variable) and have written this:
let dateObj = new Date();
let day = dateObj.getDate();
but within how a lambda function works, I'm unsure how to set up the service and call this date (day) to be returned.
Does anyone have any resources that outline constructing and using a lambda function in the most basic, most essential way possible? Will the code I wrote serve the purpose I need?
I'm a little out of my element and just need a few gaps filled in before I can learn the rest on my own.
Thank you!
This Node.js/Lambda tutorial might help get you going: https://dev.to/adnanrahic/getting-started-with-aws-lambda-and-nodejs-1kcf

HTTUrlConnection Set Header doesnt work

I have encounter recently an interesting problem.
I am trying to access sametime by using the integrated REST API. To do that i wanted to prepare an XAgent that is doing the lookup and data connection for me.
The first two steps to connect to the Sametimeserver work perfectly fine but i have a problem with the last step. Regardless what i do i cant set the header of the GET request. I tried it with other fields then one mentioned below but it looks like its not setting the header.
Anybody any idea why setting the header in SSJS doesnt work?
var url = new java.net.URL("http://oursametimeserver/stwebapi/RTCServlet?"+sid);
conn= url.openConnection();
conn.setRequestProperty("Rtc4web-Nonce",pid);
conn.setRequestMethod("GET");
writer.write(#Implode(conn.getHeaderFields()));
Please see the results:
{null=[HTTP/1.1 400 Bad Request], Cache-Control=[no-cache="set-cookie, set-cookie2"], Expires=[Thu, 01 Dec 1994 16:00:00 GMT], X-Powered-By=[Servlet/3.0], Content-Length=[170], Content-Language=[en-US], Content-Type=[application/json], Connection=[Close], Date=[Mon, 09 Mar 2015 19:18:54 GMT], Set-Cookie=[JSESSIONID=0000zwXn8VhNWlZ78jN4yfMJQrU:-1; Path=/; HttpOnly]}
Please ignore the Error 400. The rest api returns it because i am not submitting the RTC4WEB-NONCE field in the header. I get the same result when i use POSTMAN in chrome. With that value everything is fine.
You need to change your approach slightly:
1) Write a small Java class that wraps all the call to Java objects, so you can call that one with a simple JS call. It takes the "map a untyped js variable to a typed Java method" guesswork out of the picture
2) Don't use the HttpUrlConnection class. Either use the ApacheHttp Client which is both available and has methods to set the header - or use the social business toolkit that has ready functions to connect to Sametime

Post a text request in Casablanca (C++ REST SDK)

I am writing a client side code in Visual C++ 2012 using C++ Rest SDK (codename "Casablanca").
I have a client created and wish to POST a text string to the server. However, when I send the following code, it is compiling but not sending sending the request.
When I remove everything after "methods::POST" and send a blank post request, then it is sent and received by the server.
Can you please guide me where the problem is. The documentation related to this function is available on Casablanca Documentation.
pplx::task<http_response>resp = client.request(methods::POST,L"",L"This is the random text that I wish to send", L"text/plain");
I think the usage you give here looks correct.
Is your Casablanca the latest version ? Please check that out from here : http://casablanca.codeplex.com/
If you are sure your measurement is accurate, you may want to create a minimal repro and file a bug here : http://casablanca.codeplex.com/workitem/list/basic
I was having a similar problem, all my POSTs was arriving in blank on server , after a few hours work above it, i found a possible solution.
I changed the default content type to application/x-www-form-urlencoded and I started to pass the values like this Example data=text1&data2=text2
client.request(methods::POST,L"",L"data=text1&data2=text2", L"application/x-www-form-urlencoded");
The body parameter must be a json::value.
I cannot comment yet so I have to put my thoughts in an answer. I solved this problem like this: There is an overload of the request method that takes as a parameter the content type so that you do not have to change the code.
m_client->request(methods::POST, L"/statuses/update.json?" + url_encode(data),L"",L"application/x-www-form-urlencoded");
Obviously you would have to implement the url_encode method but that is not difficult. There is a pretty good implementation in "Cassablanca". A search on this site will alos turn up some good examples.

MgTwitterEngine Iphone

Hello
I am using mgtwitterengine in iphone to call twitter API. I want to retrive followers name
in my iphone.
I used textfield.text=[_engine getFollowersIncludingCurrentStatus:YES]; but it is not showing correct result. it only show some alphabets...
could anyone tell me how to do this.
you are using
NSLog(#"%#",[_engine getFollowersIncludingCurrentStatus:YES]);
getFollowersIncludingCurrentStatus not responding the result, it returns connection identifier which is DF387EE5-05CE-40E3-A12D-4D016C581233 in your case
your API response will come in this method
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)identifier
this is delegate method you have to add this in your class.
[_engine getFollowersIncludingCurrentStatus:YES];
use like this it may help you, i got the values and printing on console

Resources