call a plugin from javascript crm? - javascript

i need to pass some values from JavaScript to Plugin.
and need to retrieve resultant result from plugin should get invoke in the java script.
can anybody guide how to proceed with this approach.
please send some sample code & Link , how to invoke plugin from java script and pass parameter.
How to get the resultant from plugin to java script.
My plugin fires in retrieve multiple and ill get a collection of records. based on the plugin result , i need to use the result in my java script.
If i am not still clear , please find the bellow link what exactly my requirement .,
Can you please guide me how to proceed on this.
Thanks

You can't call a plugin from javascript.
But, you can retrieve records from CRM, for example with ODATA. On the Retrieve / RetrieveMultiple event of the entity, you can register a plugin with some custom code. Place the result of the plugin in a field of the entity. Then read the result from the entity which you retrieved by ODATA. You can create a custom entity for this Plugin Messaging Mechanism.

Related

How do I add this API to my Javascript program?

How do I add this API: http://developer.simsimi.com/api to my javascript script? I have the trial key, but I don't know how to add it in. Basically, when someone types '#Bot ' the script should reply back to the '' using the API. I just need to know how to incorporate the API into my script, I've searched up tutorials but I still don't understand how to do it.
You just need to call the api using HTTP GET Methods, look the URL they provided for trial version:
http://sandbox.api.simsimi.com/request.p?key=your_trial_key&lc=en&ft=1.0&text=hi
So you need to replace your_trial_key with your trial key you have, text with the key you want to use and then use HTTP GET in javascript to fetch the result and then show it on your page.
You can use is it in any library like React, Angular or jQuery for example, for get method in jQuery visit the link below:
https://www.w3schools.com/jquery/ajax_get.asp

Login Required when using AdminDirectory.users.Get in javascript

I am writing an application to list or update users using Javascript. I have enabled the relevant API's in dev console. This all works ok if I use AdminDirectory.Users.list, however when I try to get a single user via AdminDirectory.Users.get and pass the google ID as the key, I get Login Required.
I have tried to add option .viewType = "domain_public" but to no avail.
For now, Im going to re-write the local function that uses .get to get the user via list, but would like to know if anyone else has this problem or know how to fix it.
I ran into the same issue when I tried to write a custom function to retrieve the users in our directory. After reading Paul's comment, I checked and found that custom functions operate with same minimal permissions, so I also added a custom menu to load the users.
At risk of giving advice without testing it myself: for triggers, you'll need to use an event with an authMode value of FULL.
See the Google Apps Script Event Objects guide.

Alfresco default filter documentary library

I have some kind of document in my documentary library which have a custom metadata value. I want to hide these documents from document library and search result.
I know filter javascript management is in this file :
alfresco-remote-api-5.0.d.jar\alfresco\templates\webscripts\org\alfresco\slingshot\documentlibrary-v2\filters.lib.js
I don't know how to modify code for hiding document which has "1" as value of my metadata (sc:customMetat).
Thank you for helping me.
With below you can hide document in listing.
document.addAspect("sys:hidden");
If this doesn't works ,you need to manipulate permission.Remove access for specified users , or groups.

angularJS & web2py: calling python from ng/javascript/html

I'm using AngularJS (mainly the client side) and web2py (mainly the server side)together in an app.
I have an issue now.
At a point of the program, I use AngularJS to get some data from the client and these data are store in an AngularJS variable. I planed to use $http.post to submit these data to database directly, but it didn't work due to cross-orign problem.
Right now I'm trying to pass these data(they are in JSON format) back to web2py and let web2py insert these data to database.(similar to submitting a SQLFORM).
Is there anyway I could pass these data as an argument to an web2py function and invoke that function within javascript code?
Possible approach in my mind:
1) Since I could write python in html using {{}}, and I could write html in javascript, could I write python code within javascript using something like: document.write({{python code}}) ?
I tried this but whatever html I write it goes to a brand new html page. I also tried document.getElementById('testDiv').write("<p></p>"); But it doesn't work.
2)use ajax, I'm not familiar with ajax, any example will be really appreciated!
Any thoughts?
Thank you all!
ok so you got me lost for a second there, lets see if i got it right
1- angular as your frontend
2- python as your backend
3- you are rendering an html document in python and delivering it to the browser
4- since python template language uses {{}} as delimiter am assuming you changed the angulars delimiters too
either using ajax or reload you'll need to provide a python post handler script. that takes your data and makes the DB update. if this is going to be a pattern and you are going to be making AJAX CRUD operations, you should use angular resources ngResource if not a simple
$http.post(url,data).success(function(response){})
https://docs.angularjs.org/api/ng/service/$http#post
where url would be your form submission handler url.
if you where to use a form you'll need to set the target to an iframe hidden in your page and the response should a script tag that gets the scope pertinent to your controller and let him know the result of the operation. this is an old approach, but handy when it comes to send information to sites that don't allow CORS which by the way might be the solution to your problem, when storing data directly to your db, you might just need to enable CORS headers in your storage engine API and that should allow you to submit information even when coming from a different domain
After hours of struggles and countless google, here's my workaround solution:
Main problem: the data are stored in AngularJS but AngulatJS could not submit data to database through API due to cross-orign issue. But Web2py could submit data to database using sqlform.
My approach:
1.)When the user click the submit button, invoke 'ng-click="submitBtn()"'.
submitBtn() is a function of the ng-controller, which has access to the data.
2.)In submitBtn(), the function first write data into web2py's sqlform through
document.getElementById('inputId').value=$scope.data;
then the function click the sqlform submit button through
document.getElementById('submitBtn').click();
It took me a lot time to figure out those element ids of fields in web2py's auto-generated sqlform. The way to find them is using developers' inspect element tool in a browser and see the source code directly.
Hope this will help someone will face the same issue!

What is GetOrganizationService in javascript

I was looking at code provided at
https://stackoverflow.com/questions/10978236/pass-a-parameter-to-a-crm-2011-workflow-via-the-api
which is supposed to create a Note via javascript. In this code there is a line which reads:
var orgService = GetOrganizationService();
Do I have to have another function "GetOrganizationService"? If so, can someone show me how to do this? Or is this a built-in CRM method that will be understood?
I don't know any function like that, my guess is that method is part of a api that someone create to abstract all the work to call for example the Web Services of CRM via Javascript. For example of a api check this article have a example of a annotation.
I know two ways to create a record of entity via Javascript:
Via Web Services of CRM:
http://msdn.microsoft.com/en-us/library/cc677070.aspx
Via Odata:
http://lakshmanindian.wordpress.com/2012/10/07/create-noteannotation-using-jscript-in-microsoft-dynamics-crm-2011/

Categories