DOM interaction with Turboforms - dynamics-crm-2015

I need to go unsupported way and do some cosmetics on a form. Seems that from the onLoad method I'm not able to hack the DOM anymore. And looks that all the fields are not searchable either $("opportunityid_c") returns nothing. I was wandering if someone already managed to crack this.

you should be able to find the DOM-Node of the field with
parent.window.document.getElementById("opportunityid_c");
See also at Impact on unsupported code

Related

GET a slide, edit it, and POST it again with minor changes

I was hoping someone could help me with something i've been stuck on. I'm not even sure if it's possible to do.
So i basically have a huge Json file which includes all objects used for a certain slide Specifically i used this GET command:
GET https://slides.googleapis.com/v1/presentations/{presentationId}
I then got a huge 200.000 line Json response which has alot of stuff like colors for each thing, position of every element on each slide ect. I save this as a JSON file on my pc. I only need it once as a form of template.
Then my golang code dynamically edits some of its values (after converting it to structs ofc).
Now i want to POST it back up. It has a new name now, new ID, but 99,9% of the values are the same.
Is it possible to do this?
And sorry in advance. I know people here tend to get mad at "stupid questions" or if i forget to add something, but i'm new here, and i hope I can get some help. Been stuck for a long while.
Yes, you can. There is a Go client library that allows you to do this if you're not set on using a REST API. If you are set on using a REST API, you should be able to post this endpoint:
POST https://slides.googleapis.com/v1/presentations/{presentationId}:batchUpdate
Side note, the Google documentation (imo) is fantastic, a little googling goes a long ways :)

In #ngxs/form-plugin, what is the definition of the properties mentioned in the example?

Please expand your NgxsFormPluginModule description on gitbook.
I just implemented a reactive forms example with #ngxs/form-plugin.
It works great, but it was a bit of a struggle to get it to work; because it was not clear to me that the form state must have these specific properties:
model: YourFormModel,
dirty: boolean,
status: string,
errors: {}
Maybe you could add an explanation of these properties and their intended use?
What are the possible values for status, or is this up to the developer to define?
What type of object is errors and what is it used for? It appears to be empty even when validation fails. errors would suggest it is an array, but the example defines the default as an object?
I am posting this as a question because of your answer here: Where is it best to post questions about ngxs?
status field is supposed to store latest status of FormGroup.
You can see the code that is responsible for its update here.
The possible values for status are defined here.
errors is supposed to contain validation errors for the whole form group.
Its type is ValidationErrors since it's supposed to copy errors from the corresponding form group.
The code responsible for its update is supposedly here.
But there's an unsolved issue with filling it with actual error data., so it's not available yet and you'll have to rely on controls' error data.

Extract value from javascript object in site using xpath and import.io

I want extract a number provided by javascript object in site, but I really don't understand that I am doing.
I tried different versions using alike examples and guidelines in import.io site and other tutorial sites, but I got only 1 of two results: extracted all numbers on given page or nothing at all.
I tried e.g. //[contains(.,"Unikālo apmeklējumu skaits:")]#type ; //[contains(.,"Unikālo apmeklējumu skaits:")] . Most likely it's necessary to add there something else, but I just don't know that.
Link I am interested in to extract from is: https://www.ss.lv/msg/lv/clothes-footwear/womens-clothes/trousers/ikcbb.html and information necessary is a number after text "Unikālo apmeklējumu skaits:" which is given by javascript.
Hopefully someone will be able to help me with this problem.
For someone who is new in web-scraping this should be a hard task, I'll ty to explain it. First of all, the xpath to get to that location could be something like this:
'//td[#class="msg_footer" and contains(text(), "Unik")]'
Now you have that tag (and what it contains), but if you check it doesn't contain the number you need, that content is being dynamically loaded with a javascript, and the javascript is this one:
<script type="text/javascript"><!--
var ss_w='rādīt numuru';
document.write( '<scr'+'ipt id="contacts_js" src="/js/2015-10-27/37863/VHoBGkpqSV8bfwkdTX9AXEpZXCVDlASIQ1ZV3kK.js?t='+new Date()+'"></scr'+'ipt>' );
--></script>
which could be gotten from the response with this xpath:
'//script[contains(text(), "contacts_js")]/text()'
from that string, you should replicate the url that comes in src, so this url for example:
/js/2015-10-27/37863/VHoBGkpqSV8bfwkdTX9AXEpZXCVDlASIQ1ZV3kK.js?t=
and add to the end the current date, as javascript creates it with new Date(). Then you should make a request to that url (adding the previous response domain), so something like:
https://www.ss.lv/js/2015-10-27/37863/VHoBGkpqSV8bfwkdTX9AXEpZXCVDlASIQ1ZV3kK.js?t=Wed%20Oct%2028%202015%2020:56:42%20GMT-0500%20(PET)
check that the date is urlencoded. it should return a response like:
var PHONE_CNT=-1;var PHONE_CNT2=-1;var PHONE_CNT3=-1;var EMAIL_CNT=-1;var SHOW_CNT=22;var PH_c="";var PH_1=0;var PH_2=0;var PH_3=0;
pcc_id=0;PH_1=gpzd("JTg3aCU3QyU1QnolN0MlN0JYcWh6JTVCdCU5NSU4QyU5MnV4ayU5QXElN0IlOTQlNUNweiU5MGtvJTdCJThFJTVF","55937369");
where you can check that the value inside SHOW_CNT is the number you want.
If you want to know how I figured out which request and which script was populating that response tag, well that I did using firebug, searching for SHOW_CNT inside all of the responses that involve calling to your URL, which pointed to the request I specified, and then trying to check who was requesting that.
Hope it helped.
support#import.io are the guys to speak to, they give free advice and help trouble shoot problems just like this all the time.
There are all kinds of tips and tricks you can use... for example import.io provide (an undocumented beta) JavaScript Pre-render service that would likely work for you in this scenario. API publish failures are sometimes caused by timeouts while waiting for sites to render JS, this would fix that.
http://support.import.io/knowledgebase/articles/623235-infinite-scroll-and-javascript-prerender-beta
I hope this helps.

How to get object specific events using Box Api

I am having difficulty getting the events for a specific object. Basically I would like to have an event collection that reprents the "Access Stats" when looking at a file's properties on box.com. The only way I can figure to do it now is to run through all events in the stream and manually build the collection. Is there not an endpoint I can use or a query filter I can put on the events endpoint to accomplish this?
Thanks
Shawn
This is something our fields parameter would help with, but it's not yet GET /events. Keep an eye on this portion of our documentation for when support for this is available. http://developers.box.com/docs/#fields

How to explicitly validate a knockoutJs observable

I'm using KnoockoutJS and the validation plugin from here, https://github.com/ericmbarnard/Knockout-Validation.
By default, validation messages only appear after a field has been modified. The problem is that when the user clicks "Save", I need to validate the bound observable regardless of whether the user has modified the field or not.
I can't seem to find a .Validate()on an obervable...
Looks like ko.validation.validateObservable might be what you're looking for... I didn't test it, but that looks like it.
I use ko.validatedObservable($data)().isValid() to get whether the viewmodel is false or not.
If there is somebody who knows a better way, please leave a comment :)

Resources