Kentico page update not update Physical table - kentico

I Have Kentico web site which has scheduler task that synchronise data with external Database. Basically few pages created from external database table. We have two methods for both create and update record in Kentico table.
For create we use
TreeNode page = TreeNode.New(Helper.ClassName_Campus);
page.SetValue("Title", "Title");
page.Insert(parentPage);
Create record works fine and update physical table data.
For update we use
TreeNode page = DocumentHelper.GetDocuments(Helper.ClassName_Campus).OnSite("site").Where(" ID", QueryOperator.Equals, 1).FirstObject;
page.SetValue("Title", "Title");
page.Update();
Update method does works OK. when i go to page and form data i can see new data on the form field, but it doesn't update actual physical table data. How can we update the actual physical data table when updating page. where is Kentico store form data after update.
This is the link we found on kentico web site for update table data.
https://docs.kentico.com/display/K9/Working+with+pages+in+the+API

Kentico content tables (the ones bound to a page type) always contain only published data. In case you are using workflow/versioning the "new" data will be stored in CMS_VersionHistory table instead.
The solution is simply to publish the page by using something like:
var page = DocumentHelper.GetDocument(1, new TreeProvider());
page.DocumentName = "Update name";
page.Publish();

Did you use workflow for this pages?
You can try to using DocumentHelper.UpdateDocument(...) and specify there a TreeProvider, because maybe you don't have permission to update this page.
Here's the link to API how manage the page

Related

Power Apps : Get users from Azure AD to Power Apps view to list table and refresh button for table

I am facing issue, with Azure Power Apps. When I add users from Azure AD:
AzureAD.GetGroupMembers("Object ID").value
And then I get users to my table(my table name: TableCollection), but then I have created a refresh for my Table , but it does not refresh it when I click refresh.
My syntax for Refresh button is:
AzureAD.RefreshTokens("Object ID")
I also have tried to just simple refresh for my table(my table name: TableCollection):
Refresh(TableCollection)
Does anyone know on this situation how to give correct syntax for refresh button?
Refresh() method can only be used on a data source.
So you should add AzureAD.GetGroupMembers("Object ID").value into a data source (I name it as AADData).
Collect( AADData, AzureAD.GetGroupMembers("ed9a0284-3ce5-4ae4-9d0c-68eb8e460330").value)
And reference the data source from your table.
Then add a refresh button with the OnSelect = Clear(AADData); Collect( AADData, AzureAD.GetGroupMembers("Object ID").value).
In order to fill in the TableCollections you would have used the Collect function.
Something like this
collect(TableCollections,AzureAD.GetGroupMembers("Object ID").value)
In order to refresh this you can use the method ClearCollect
The ClearCollect function deletes all the records from a collection. And then adds a different set of records to the same collection.
Clearcollect(TableCollections,AzureAD.GetGroupMembers("Object ID").value)
So in the above line, the tablecollection is cleared and the records are freshly updated from the data source.

SharePoint 2013 Online - How to set up a filtered column linked to itself

I am a newbie with SharePoint. I have set up a document library. One of the columns is a unique id for a document. Another column called Related Document is a lookup field that may contain a clickable link to another document's unique id.
How to automatically fill in related document column with the link to the original document? That is, if I make document A be related to document B, I would like to automatically add a relationship from B to A as well. Not sure if it's possible to do with Related items feature - it does not seem to allow a clickable link.
Thank you.
The only way I can realistically see this being done is with a Remote Event Receiver. https://msdn.microsoft.com/en-us/library/office/jj220043.aspx
I can't think of a way out of the box that would do this.
You will need to create a SharePoint Add-in and deploy it to your SP Online instance. The remote code will get hosted on an Azure instance.
The remote code will get triggered when a document is updated.
You can then get a reference to the related document and fill in the related document link field accordingly.
You can pass parameters with the source parameter of SharePoint. This is actually to forward an URL to jump back to, but can be used to automatically pass parameters to the second form of the library.
Here is a small function that opens an upload dialog e.g. to be inserted in a content editor WebPart:
function openUploadDialog(passParameterName, passParameterValue)
{
var dialogOptions = SP.UI.$create_DialogOptions();
dialogOptions.url = "/_layouts/15/Upload.aspx?List=[INSERT_LIST_ID_HERE]&RootFolder=&IsDlg=1&source=%2fSitePages%2f[SOME_SITE_OF_YOURS].aspx%3f" + encodeURIComponent(passParameterName) + "%3d" + encodeURIComponent(passParameterValue);
dialogOptions.width = 700;
dialogOptions.height = 310;
dialogOptions.title = "Submit Document";
dialogOptions.dialogReturnValueCallback = Function.createDelegate(null, CloseThisDocCallBack);
SP.UI.ModalDialog.showModalDialog(dialogOptions);
}
openUploadDialog([NAME_OF_YOUR_ID], [VALUE_OF_YOUR_ID])
Short:
Add a field with the ID (or whatever you want) to your Library
Create a Content Editor or script WebPart where every you want and use the
function to open a dialog
look at the source of this webpart to find out the DOM ID of the field
Add another webpart to your Upload Form (Ribbon => Library => Form Webparts => Default Editor Form) to take the value from the source paramter (e.g. via JQuery) and write it into the new field you've just created.
Something like this:
id = GetUrlKeyValue('[NAME_OF_YOUR_ID]');
$('#[DOM_ID_OF_YOUR_CUSTOM_FIELD]').val(id);
I used this once to add an ID of a list element to the file. Hope that this is what you were looking for.

XPages: Erratic access to a 3rd database

I have a db, I'll call it db X, that contains all the XPages programming that accesses data in dbs A and B. This is only used for web access, not in a Notes client. One primary XPage in db X displays data from db A in a view (viewA) on one tab, and from db B (viewB) in another. This works great! However, when I click on a doc in viewA, it opens in another XPage just fine, and has a filtered version of viewB that is supposed to show just the docs from db B relevant to the current doc from db A. But it is completely empty. If I remove the filter, it should display all docs in db B, but is still empty. I've verified that the data source for viewB is identical on both XPages. Note that db A and db B are on the same server, and are even in the same folder. Db X is on the same server as the other 2, but in a different folder (above the other 2).
Any ideas why viewB works in one XPage and not the other?
For your "embedded view" data source (viewB in docA) set the ignoreRequestParams property for the Domino view data source to true to ensure the view data source does not use the document ID that was present in the URL.
ADDITIONAL DETAILS: In a two-page application involving a "view" XPage and a "document" XPage, when the application user clicks a link on the view page to open the document on the document page the ID for the document to open is passed with the REQUEST parameters. You can see this in the resulting URL for the document page which will have the ID for the document to open appended to the URL address, for example &documentId=49530CA58D17CCE5852575150069D857&action=openDocument. This works perfectly when the document page has only one Domino document data source. However, in the embedded view application the "document" XPage will also include a data source for the xe:dataView. When ignoreRequestParams is NOT true for the Domino view data source (and for any other additional data sources on the page) then the parameters passed in the request ARE evaluated to determine which view entries to display in the xe:dataView. These request parameters point to a UNID that is not the desired data source for the view so no view entries are displayed.

Get listitems from Current Site

I am trying to create a Page Layout, that should have a lookup field. Lookup field should always get populated with a list's items.
This list will exist in all subsites, so whereever I create this page, list should get populated with listitems from current site.
I tried using site column lookup field, but it always point to list under top site and not the current site.
Any suggestion on how to make it work or better alternative? Thanks!
Let me know if I can provide more info.
The most straightforward solution I can think of is using a cross site lookup column and creating a seperate fields for each subsite. However, you will need to create and use different Page Layouts for each subsite.
You can use http://sp2010filteredlookup.codeplex.com/ for cross site lookups.
Solution 1 - Use http://sp2010filteredlookup.codeplex.com/
Use filtered lookup solution. So let's say you have your custom Page Layout and custom Page Content Type.
Every time you create new subsite, you should remember go to Pages list settings and edit Page Content Type by adding cross site lookup (with the same field "internal name").
So you still have one Page Layout (and one Content Type). But for each Pages library instance, Content Type contains diff fields (but with the same Internal Name). It will allow you run CAML queries and other things needed without any problems.
Solution 2 - develop custom sharepoint field type.
In edit mode, control will render "dropdown list" and populate data from list instance that is on current subsite. In the field settings you can have relative list url.
Solution 3 - hidden text field / js snippet solution
Page Content Type can contain hidden text field (it can contains selected field value in json format for example). Develop js snippet that will handle all the logic (rendering in edit/view mode, saving etc) and put it on Page Layout (aspx).
I would suggest to use solution #1 or #2.

MOSS 2007 Content Types - farm wide application

We have an issue with rolling out content types with features. How does one roll them out to the SharePoint farm and update the database at the same time. Right now, we cannot figure it out. Is there something that has to be done custom?
By "update the database" I would assume that you mean your custom database, not any of the SharePoint databases?
Deign your database so that you will have some sort of mechanism to store the version. In its most simple form, a configuration table with a version row/column would be sufficient.
You can in the feature activated event, place code that checks the version of your database and, if necessary, performs any custom T-SQL scripts that updates your database.
Content types can be confusing to deploy. Once you deployed the content type by a feature and someone is using this content type (I.e a Sharepoint list, document, page layout etc) you CANNOT update the content type by redeploying the feature. This is by design. When a list adds a content type it makes a copy of the content type in the site collection.
There are two ways to solve this:
Update the content type in GUI and check "update all child content types"
Create a new feature "update content type x feature". Add a event handler to the feature activation and update the content type in the site collection by applying the contentType.update(true) method. To verify that all the child content types are updated create a SPQuery object with an beginswith parameter to the content type id.

Resources