Sharepoint Modal - pass values using options and read from server - sharepoint-2010

I am using Sharepoint dialogs.
I have followed this article to pass values to the dialog:
http://online.appdev.com/edge/blogs/doug_ware/archive/2010/09/25/passing-values-from-a-list-custom-action-to-server-code.aspx
this suggests to use read values usingwindow.top.g_childDialog.get_args() & storing the value as JSON in a hidden field, so that they can than be read by server code.
I managed to make this work.
However my problem is that I need to use this value from the server side immediately and having to pass this value from the client to the server.
As a I work around, I am doing a __doPostBack to go back to the server (after setting the hidden field), & in the server code, I read the data from the input field.
However, there is clearly a performance issue here as I am doing an extra postback.
Is there a way to read the options immediately from the server rather than from Javascript.
I know that you can use the query string (rather than options) but I have a relatively large amount of data that I need to pass and I do not want to use query string.
Any help would be greatly appreciated.
Thanks!

What you can do is create an "empty" SP.UI.ModalDialog by pointing the URL in the options to #. Then programmatically create a form with a hidden field in the dialog's iframe. And execute a post request on this form.

Related

Localhost API for TD Ameritrade

I was creating an API for TD Ameritrade (my first time creating or dealing with APIs) and I needed to put in my own call back URL. I know that callback URL is where the API sends information to and i heard that I can just use my localhost API. I scoured the internet and I dont know how that would work and I was wondering if i can just use http://localhost?
Sorry if I seem like a noob because I am
In short, yes.
Follow the excellent directions at
https://www.reddit.com/r/algotrading/comments/c81vzq/td_ameritrade_api_access_2019_guide/. (Even with them, I spent excessive time on trial and error!)
Since stackoverflow has a limit of 8 links in a response, and the localhost text string looks like a link, I’m showing it with the colon replaced by a semicolon, i.e., http;//localhost to reduce the link count. Sorry.
I used the Chrome browser after first trying Brave, which did not work for, possibly because of my option selections.
Go to https://developer.tdameritrade.com/user/me/apps
Add a new app using http;//localhost (delete existing app if there is one).
Copy the resulting consumer key text string (AKA client_id or OAuth User ID).
Go to https://developer.tdameritrade.com/content/simple-auth-local-apps, follow instructions. Note: leading/trailing blanks were inserted by MSWord due to copy/paste of the auth code, which had to be manually deleted after wasting excessive time identifying the problem. The address string looks like:
https://auth.tdameritrade.com/auth?response_type=code&redirect_uri=http%3A%2F%2Flocalhost&client_id=ConsumerKeyTextString%40AMER.OAUTHAP
This returns a page stating the server refused to connect, but the address bar now contains a VeryLongStringOfCharacters in the address bar:
https;//localhost/?code= VeryLongStringOfCharacters
Copy the contents of the address bar, go to https://www.urldecoder.org/, decode the above, and extract the text after “code=”. This is your refresh_token
Go to: https://developer.tdameritrade.com/authentication/apis/post/token-0, fill out the fields with
grant_type=authorization_code
refresh_token=<<blank>>
access_type=offline
code=RefreshTokenTextString
client_id=ConsumerKeyTextString#AMER.OAUTHAP
redirect_uri=http://localhost
Press SEND.
If the resulting page starts with HTTP/1.1 200 OK, you have succeeded.
Try updating your redirect to:
redirect_uri=https://localhost
They may require https now and you need a colon instead of a semicolon. Everything looks correct. This process generally takes me more then one attempt, and 15 minutes to an hour to get my refresh token squared away every 90 days.
dont use #AMER.OAUTHAP in client_id
If you generate a new code and based on that try to get a new access token. it should work.

CloudConnect: Dynamic URL in REST Connector

What is the best way to create a dynamic request URL for the REST Connector in CloudConnect?
e.g. I want the URL to be for example www.myservice.com/api/{todays-date}/report.json and the URL must change accordingly everytime the ETL runs.
Is there some way to make this happen by code in CloudConnect? I didn't find any straight forward way but I found that one might be able to import a remote file containing the URL.
Does anyone have experience or tips on this subject?
what should work the best is to generate this parameter (e.g. in Data Generator) or read some data from the source (e.g. list of IDs) and send it to the REST component as an input parameter (e.g. metadata field name is 'today_date', so use ${today_date}). As far as I know this should work.
Another option is to use a parameter from a *.prm file (like workspace.prm). You can use ${PARAMETER_NAME} in your URL and this should also work correctly.
Hope this helps.
Radek

How to access Custom Form data within the AtTask REST API (version 4+)?

For a project I'm working on, I need to access Custom Form data via the AtTask REST API. Specifically, I need to surface the text associated with any checked checkboxes within a custom form.
To see where this data might be visible, I've done a query of the form:
https://<company>.attasksandbox.com/attask/api/v4.0/task/search?method=get&sessionID=xxxxxxxx&fields=parameterValues
...but I'm not seeing the checkbox data I'm looking for.
Is it possible to surface this kind of data via the API?
If so, what's the proper syntax?
The parameterValues fields will return all the custom data that is set on the task. You can request the specific parameter by calling it by name like DE:Parameter Name. Both will only return the selected values of the checkbox. If you would like all values for the field then you will need to pull them from the parameter and parameter options objects.
https://<company>.attask-ondemand.com/attask/api/v4.0/popt/metadata

Report Builder 3.0 with SharePoint List as data source using relative URL for list

I'm using Report Builder 3.0 to create a report for use in SharePoint 2010. SQL Server 2008 R2 is the back end with Reporting Services in SharePoint Integrated Mode. One of the cool features of Report Builder 3.0 is the use of a SharePoint List as a data source, the setup for which is very straightforward--just give it the URL for the SharePoint List as the connection string and it works.
I eventually want to package this site as a Site Template including the report that lives in it, which means that the URL will need to be relative instead of absolute. So for example instead of this:
http://mainsite/subsite1/lists/mylist
... I need to specify something like this:
mylist
... so that when I package this as a Site Template and create a new site based on that template, the report will work with the new site's list instead of pointing back to the original site's list URL. I've tried "mylist", "lists/mylist", etc.--everything short of specifying subsite1/lists/mylist--but nothing has worked so far except for the full URL.
Is it possible to use a relative URL or some other method so that the connection string won't have to be manually changed in the report every time I create a new site based on this site template?
Edit: I misunderstood what needed to go in the data source's connection string. It's not the URL to the list but rather the URL to the site that goes in the connection string. The concept of the question remains valid though--need to dynamically set the connection string of a data source that points to a SharePoint list.
After brainstorming with some co-workers we figured it out. The key is to use an expression for the connection string. Using my original example the goal is to get this:
http://mainsite/subsite1/
... in the connection string but without hardcoding it--make it dynamic based on where the report lives so the report can be packaged along with the rest of the site as a site template. The expression I ended up with is:
=Replace(Globals!ReportFolder, "Reports", "")
The report lives in a library called "Reports", so Globals!ReportFolder returns:
http://mainsite/subsite1/Reports
The Replace() function then takes out the "Reports" part of the string, and the result is the connection string I wanted.
Things to look out for:
You can't test the expression while you're building the report. I had to hardcode the site URL into the connection string so the designer could populate the list of lists when creating a dataset based on that data source. Otherwise it doesn't show the available lists and you have to manually type everything. After designing the report I changed the connection string to the expression, and when deployed it worked.
When testing make sure to refresh your browser view instead of the little refresh icon in the report's task bar. Seems like the report's built-in refresh only grabs new data but uses the rdl file it already has on hand, whereas refreshing the browser forces it to get the latest copy of the rdl as well as latest data. That's probably self-explanatory, but it caused me some confusion for a few minutes when it didn't look like my design changes made any difference, so hopefully this will help others not go through the same confusion.

How can you hide/unhide Reporting Services report parameters via URL query string?

I'm trying to figure out how I can dynamically hide/unhide parameters for a Reporting Services report I've created via a URL query string. I've tried reading a whole bunch of stuff I found through a Google search and I've also tried reading various MSDN documents regarding SQL Server, but I have yet to find a way how I can pull this off. Does anyone know how I can accomplish this? Thanks in advance.
Not sure if you still want this, but you'd use the &rc:Parameters=false setting in the URL
Edit: that hides/unhides the parameter block as you mentioned.
To set parameters you'd have something like &EmployeeID=1234&FieldID=43 in the URL
So you can set parameters and hide them
Edit2: you can only do this at design time. I forget the option, but you can have hidden parameters in the report parameter page that can be set via URL access or via Report manager
Well.. this just goes to show my lack of experience with SSRS. My URL was off (apparently you can't preview reports through the Report Manager in the manner I was trying to).
EDIT: Problem still not solved -- I'm now having problems hiding a single report parameter conditionally through a query string (yes I was testing off the wrong URL originally but now I have the right URL and I still have problems when it comes to conditionally hiding a single parameter). If anyone knows how to do this, please let me know!
(DISCLAIMER: May depend on the version of SSRS you're using, if you're using 2005 & up, you should be good, I believe)
This is possible, in the xml definition for the report, find the definition for the parameter, it should look something like this
<ReportParameter Name="YourParameterNameHere">
<DataType>String</DataType>
<Prompt>YourParameterNameHere</Prompt>
</ReportParameter>
And you can add this line to set hidden to true:
<ReportParameter Name="YourParameterNameHere">
<DataType>String</DataType>
<Prompt>YourParameterNameHere</Prompt>
<Hidden>true</Hidden>
</ReportParameter>
Hope this solves your issue!