How to Get a value from the current SharePoint 2010 pages Page Conent Type? - sharepoint-2010

I am looking to create a web part that will get the value of the consuming pages Page Content Type. For instance... I have a Page that has a custom Page Content Type that contains a column called ProductId. I would like to be able to access the value of the field from the web part. Can anyone steer me in the right direction?
Thanks for your help.

SPContext.Current.Item["ProductId"]

I'll take a stab without fully knowing the details. You can use SPMetal to create an entity class for your site/subsite and then use LINQ to SharePoint to get access to the data in the column.

Related

Jira Custom fields list of real names

Does anyone know if there is a list of what the custom fields equate to when calling jira via an api to bring the results back?
Not sure a way through restapi, but a workaround.
I had similar issue, so I exported JQL result with All fields which gave field names like custom_field012(SomeFieldName) then I had created a reference table with Custom_field and corresponding field name
I found this link worked and brought up a list of all custom fields.
https://MY-JIRA-URL/jira/rest/api/2/field
You also need to have your Jira open in the same browser.

Use category name in Sitefinity blog URL

I followed the instructions here on establishing a new provider and generating custom URLs, and it works as expected. There doesn't seem to be a clear reference for what parameters can be utilized in the settings as the example given is very basic.
I want to use the category name of the post in the URL. I tried:
/[Category]/[UrlName]
but what I got in the frontend was:
http://localhost:60327/my-page/Telerik.OpenAccess.TrackedList%601[System.Guid]/my-post-name
I also tried
/[Category.Title]/[UrlName]
which just threw errors.
Anyone know how to do this, or better yet, a good reference for the parameters?
I don't think this is possible since the Category property is actually a collection (TrackedList).
In theory you would need one of the collection items, let's say the first one, and your URL expression would be /[Category[0].Title]/[UrlName], but this is currently not supported by the expression parser.
Also, the idea of making the URL dependent on a complex (related) field is not a good idea. If someone deletes that category, they will break all your blog post URLs.
I would suggest you to create a custom text field for the blog post item (ex: CategoryUrl) and then you should be able to set the URL format to /[CategoryUrl]/[UrlName]. Make sure CategoryUrl field is required.

SalesForce API: No such column 'AnnualRevenue' on entity 'Account'

While retrieving basic data using the SalesForce REST API, I encountered the following errors. They seem to follow the pattern of; me asking for non-existent fields.
[{"message":"\nSELECT AnnualRevenue,CreatedDate,Id,LastActivityDate\n ^\nERROR at Row:1:Column:8\nNo such column 'AnnualRevenue' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_FIELD"}]
[{"message":"\nSELECT AnnualRevenue,CreatedDate,ConvertedAccountId\n ^\nERROR at Row:1:Column:8\nNo such column 'AnnualRevenue' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_FIELD"}]
[{"message":"\nAccountId,Amount,CloseDate,CreatedDate,ExpectedRevenue,ForecastCategoryName\n ^\nERROR at Row:1:Column:47\nNo such column 'ExpectedRevenue' on entity 'Opportunity'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_FIELD"}]
But the fields obviously exist, I can see them in the my Dev account. Is it possible that, these fields do not exist for certain types of SalesForce Accounts (Professional, Dev, Ultimate, Enterprise etc)?
To get the application working I removed the fields from the SOQL, and instead used different fields, but not all had replacements. Anyhow... any insight is appreciated.
Thanks
I'm not super familiar with the REST API, but this sounds like a privileges issue to me. Are you sure that the account you are using can see these fields? Check Field Level Security. I'm pretty sure that Expected Revenue, for example, is invisible by default.
These fields should exist for all versions of Salesforce.

Sharepoint 2010 and infopath - access workflow variables?

I have a workflow which runs every time a new list item is added.
The list item comprises of 3 fields:
a question,
a person to answer the question,
an answer.
The first 2 fields are supplied by the user who creates the list item, and the workflow routes the item to the expert who supplies #3, the answer.
On the answer form, I would like the question field to be populated with the question, however I can't drag the question field onto the form without it creating a repeating section, when it should be creating a textbox? It says the type is a group rather than just a string?
I'd also like to know how to get workflow variables into InfoPath forms.
Any ideas on how I'd go about creating a simple q&a collection workflow would be most appreciated.
The tl;dr part is the workflow needs to do this :
ask a question and specify a named user
route to user via workflow
get an answer from user
and that's it.
Your first issue is caused by the fact that your question node is a repeating node in your xml schema (see Data, Show fields, then double click the node and see that the Repeating check box is ticked). I suspect you probably wanted a repeating group with Question and Answer nodes. You would then drag the group onto the form. However it might be easier to simply hard code your schema to a specific number of questions as it'll save a bit of jiggery pokery getting the question text loaded in as you'll see below.
The second part is a little more involved and there are few good explainations on the web on how to do it. I have 2 books and neither are great at explaining this! Firstly you need to create a secondary datasource in the form and link it to an ItemMetadata.xml file which contains
<z:row xmlns:z="#RowsetSchema" ows_Question1="" />
<z:row xmlns:z="#RowsetSchema" ows_Question2="" />
etc. - note no root node exaclty like shown.
Then in your workflow you can set the value that your form will get in this secondary datasource at runtime by using something like:
MyFirstTaskTaskProperties.ExtendedProperties["Question1"] = "The text
of question 1";
In your infopath form you should set the default value of Main datasource question field to the node in the secondary datasource. Then when the thing runs it will work.
I hope you are reasonably familiar with SharePoint workflows as there are quite few other things you need to do to get an infopath form working in a workflow. In my experience it's quite painful getting it all working. Good luck my friend.

Pass a string to various websites

I have a product code which I need to enter into 6 different websites in order to pull different information from them about the product. Is there away to save this product code into some sort of variable and pass it into each websites input box and it return all the information from each one automatically? Really have no idea where to go/start with this so if anyone can brainstorm a few ideas to get me moving that would be great.
In order get what you are planning for:
You need a script which visits the specified web site,
then at the website, you can get the element by tag.
For instance in javascript,
var textBox = document.getElementByTag(Input);
This will give you a reference to text field to enter the text. It can be done as follows:
textBox.value = "any string";
Once you have done this, you will have to retrieve the results from the page, based on the website layout.
So if you can specify about your work in detail, you would get better response.
Assuming you're talking about using an ordinary GUI browser, the best you can do is copy it to your system clipboard, and paste it into each page on the browser.
If you're talking about a programmatic web-access like wget or curl, it depends on what language you are writing your script in.
you have to create the web request for each web site and find a way to parse the response which will be HTML
have a look at the HttpWebRequest you can find lots of example on internet that shows how you can create an HTTP POST to a website.
http://www.terminally-incoherent.com/blog/2008/05/05/send-a-https-post-request-with-c/