Call Web resource (Html/JS) from CRM plugin? - html

I want when some code in plugin execute, then call or trigger on some way a web resource, so is it even possible and how I can call it?
NOTE: its important that first execute a plugin and then web resource!

A plugin cannot directly communicate with form script. However communication can be achieved through the data model. Based on your comments, I would suggest the following approach.
Create a plugin to create and store the document against the case record. (Perhaps set a flag field on the case to indicate the document is available).
In your web resource have JavaScript which queries CRM using OData to see if the document is available (perhaps based on the flag field). Then provide the document for download. You may also need to make some consideration around when to offer the download, as form script will run every time the form is loaded, constantly offering the document for download could be annoying for the user.
Alternatively, just do step 1. Then the user can download the document manually like every other attachment. If you have a flag field its easy to show a message that the document is ready.

Related

How do I edit a document in a browser and save it to a database?

I am trying to write a web based application that allows the user to open a document in a browser window and edit it with some sort of editor such as MS Word (any editor will work) and then let the user save the document and have it stored in a database. I can get the document open in the browser window, but I don't know how to save it back to the database. Is this possible? The database is on the server side, not the client side.
Thanks.
This will be pretty tricky to do.
You'd probably need a Word macro or something to detect when the file is saved and then process whatever code on your server would be needed to process it.
My advice would be to use an existing browser-based document editor like Google Documents and hook into its API to do whatever database work you need.
Otherwise this will be tiresomely complex (what editors will you support? can you run arbitrary code against a user's machine? what if they're offline? etc).

Chrome Extension Plugin Ability?

I am building an extension for Chrome which gives the user a basic API. I would like for other developers to have the ability to add functions of their own to my API. For example, some developers offer a new "plugin" (which is only JavaScript code), and I want users to be able to download that plugin into their extension.
The main problem I'm facing is this:
How do you load new code into an extension permanently?
Ideally I would like to add code into the extension's JavaScript, but I have no way to write to the file; I am under the impression that I am restricted by JavaScript - is this true?
While I could perhaps load new code dynamically (by downloading some script), that code will only hold for the current run, and is not added permanently. Rather, it is gone once the user reloads the extension.
The only solution I can see so far is to create a login system where I save each user's downloaded plugins and give him the mandatory option to load them every time he opens the extension.
This method is very messy and impractical, because I don't want to make a user login every time. In fact, I would very much like to refrain from using any login system whatsoever.
What I desire is something similar to what the GreaseMonkey extension does, which is the ability to let users write scripts and allow other users to be able to download them.
I'm obviously looking to create an extension which is much smaller and simpler than GreaseMonkey, but something like GreaseMonkey is more or less what I am looking for.
Any thoughts or suggestions?
All of the "plugins" will be independent chrome extensions. You can then use Message Passing to send a message to every installed extension and the ones that are plugins should have code that goes something like:
if recieve "some identifying key"
then respond "information about this plugin"
Now your main extension knows what plugins are installed and can load their JS files using chrome-extension://[extensionID]/file.js".
That should get you started :)

Calling a Google Drive SDK from Google App Script application

i have been going around in circles here and have totally confused myself. I need some help.
I am (trying to) writing an application for a client that in concept is simple. he want a google write document with a button. the google drive account has several folders, each shared with several people. when he drops a new file in one of the folders, he wants to be able to open this write file, this file is the template for his email. he clicks the button, the system calls the changes service in the Google Drive SDK https://developers.google.com/drive/manage-changes, gets the list of files that have been added since the last time it was checked, then pull the list of people that the file has been shared with, and use the write file as a template to send that list of people an email saying their file is ready.
SO, easy enough, right?
I started by looking at the built in functions in the Google App Script API. I found this method, https://developers.google.com/apps-script/class_docslist#find in the DocsList class. problem is the description for the query simply says "the query string". So at first i tried the Drive SDK query parameters, which are
var files = DocsList.find("modifiedDate > 2012-12-20T12:00:00-08:00.");
it didn't work. that leads me to believe it is a simple full text search on the content. Thats not good enough.
That lead me into trying to call a Drive SDK method from within an App Script application. Great, we need an OLap 2 authentication. easy enough. found the objects in the script reference and hit my wall.
Client ID and Client Secret.
you see, when i create what this really is, a service account, the olap control in apps script doesn't know how to handle the encrypted json and pass it back and forth. Then when i tried to create and use an installed applications key, i get authentication errors because the controls again, don't know what to do with the workflow. and finally, when i try to create a web app key, i can't because i don't have the site host name or redirect URI. And i can't use the application key ability because since im working with files OLap 2 is required.
i used the anonymous olap for a while, but hit the limit of anonymous calls per day in the effort of trying to figure out the code a bit, thats not going to work because the guy is going to be pushing this button constantly thru the day.
i have been pounding my head on the desk over this for 5 hours now. i need some help here, can anyone give me a direction to go?
PS, yes, i know i can use the database controls and load the entire list of files into memory and compare it to the list of files in the database. problem being, we are talking tens of thousands of files. bad idea.
I wouldn't use DocsList anymore - DriveApp is supposed to be a more reliable replacement. Some of the commands have changed, so instead of find, use searchFiles. This should work more effectively (they even use a query like yours as an example).

How to save a local file programmatically given an amount of data and a file name with html5

I want to implement this use case found on the W3C File API document:
User agents should provide the ability to save a local file programmatically given an amount of data and a file name.
Example: A Spreadsheet App. User interacts with a form, and generates some input. The form then generates a CSV (Comma Separated Variables) output for the user to import into a spreadsheet, and uses "Save...". The generated output can also be directly integrated into a web-based spreadsheet, and uploaded asynchronously.
Source: http://www.w3.org/TR/file-upload/#requirements
From my understanding, it should be possible to create a completely offline Spreadsheet app with this, but I could not find a single example both in the W3C document or on the web that has this kind of use case implemented. At least not a completely offline one. Of course it doesn't need to be a spreadsheet application; a simple text editor or TODO manager would suffice. Am I missing something?
Also, would this make it possible to create one of the previously mentioned applications (text editor, todo manager or even spreadsheet app) from a single html5 file (with embedded JS and css)?
I seems I didn't search hard enough, here's an example of what I want http://html5-demos.appspot.com/static/a.download.html

Access XML page via ActionScript 3 (bypassing login screen first)

Need some help here :P
What im trying to do is simply get some data from an xml page located on a server.
However, the server first requires a username/password combination before i even get to see the xml content. What it does, is present a login form, that requires a user to provide credentials. Once the user hits the login, a js function is run, which logs the user in and then presents XML content to the user without ever redirecting the user to a different page.
So what im trying to ask is, is there a way (and if so, how) can i retrieve the XML of a page that first requires me to provide login details to the server?
Cheers
i'm assuming the XML data on the server is dynamic, otherwise you could simply copy and bundle the data into your own website - obviously.
i'm not sure of the nature of this data, but sometimes data can be accessed thru a website's backdoor, legally. you could try a quick search to see if this data is available publically, or even contact the data holder to find out for sure. in any case, you'll need to have a cross-domain policy file to access data that is not hosted on your own domain.
You cannot load variables or XML data
into a Flash movie from another
domain. For example, a Flash movie
loaded from
http://www.yourserver.com/flashmovie.swf
can access data residing at
http://www.yourserver.com/data.txt.
The text file is located within the
same domain as the SWF.
However, an attempt to load data from
http://www.NotMyServer.com/data.txt
will fail and no error messages are
displayed. The load action will cause
a warning dialog to appear.
Note: This security feature does not
affect Flash movies playing in
stand-alone projectors.
if the data is publicly available, there is probably a way to bypass this security restriction by using JavaScript and ExternalInterface to capture the data, but i'm not well versed with such routines.
this security restriction is not applicable to AIR applications.
more: Cross-domain policy for Flash movies