Is there a way to use Sharepoint version history to make a calculated column value? - sharepoint

I cannot see a way to do this natively, but essentially I would like to tap into the version history for a specific field value to calculate the difference between the current value and the last entered value.
Scenario:
Business user will update a numeric value in a column for each list item once a week to a cumulative amount. (i.e. Sales made to date)
I am currently able to see in the version history what the last entered value was, who entered it, and when it was entered. I want to know if there is a way to access this information in the form of a calculated column to find this difference (i.e. sales made this week). The solution I am thinking is adding another column for "Total Sales Last Week" and have the user manually update that when they update "Total Sales This Week" then have a calculated column to just subtract these values. However, this seems tedious since the information is already in Sharepoint. If there is a way to do this either with a calculated column, PowerAutomate flow or another method please let me know.

It is not possible to capture the Version History using calculated column. REST API is the only option that will be helpful to fetch these details. Considering this, there are two solutions that I can suggest here:
Using REST API
Create an additional column in your list and update it with the data that you will capture from version history using SharePoint REST API. Here, Rest API will be used to fetch the version history and also to update the list item.
As a trigger event to execute this code, Either you can setup a button on the page (if using any custom screen) or set this to execute periodically.
Using REST API in Power Automate (Recommended)
Power Automate/MS Flow doesn't provide any direct connector to fetch the version history but you can use the HTTP request connector which will help you to execute the SP rest call to fetch the version history.
Once you have version history data from your HTTP request call, you can use that to update the column in your list using the same power automate in next action.
This solution will be more useful as you don't need to setup any trigger event as mentioned in the first solution but instead of that you can simply configure this Power Automate to run as and when list item is updated and you will be having immediate result in your list.
You can refer to this link to check how to get data from HTTP request using Power automate and you can also refer to this link which will help you to understand how to get version history using SharePoint rest API.
I hope this will be useful information for you to achieve your goal.

Related

can some one help me create a Power Automate flow

A power automate flow triggered on a daily schedule will check the list for any tickets that meet (or exceed) due date and submit a ticket to Orion via email. The last run and due date will then be updated. The system may be used to trigger tickets in supplier interface in the future - the destination system should be considered in the list schema.
i am having a hard time to develop a flow that executes the above requirement.
In Power Automate, create a scheduled flow that runs every day.
Declare all variables you will need later.
Assuming you store the value of the last run timestamp in a configuration SharePoint list for example, search and use the action Get item to get the list item where the last run time is stored in this list (you're have to create it if not existing though).
Search and use the function utcNow() in an expression to get the current datetime value.
Convert the previous datetime value with the action Convert time zone to an ISO-8601 datetime using FormatDateTime() function according to your timezone.
Search and use the action Get list items to get all the items of day from your SharePoint list, and filter the query via an OData expression according to the rule (today's date =< last run date + frequency).
Search and use Send an email V2 to send email.
Search and use the action Update item to update the last run time that is stored in a list item in the configuration list mentionned at the beginning.

How to loop through all line items of a sales order and get the earliest term start date

We are building out the ARM module of Netsuite and our director of Accounting would like the Contract Start date on the header level to be populated with the earliest Term Start date from the line items on the sales order.
I'm just starting this project and am new to Suite Script. I'm hoping to get pointed in the right direction and work f rom there.
To filter earliest date from lines, you first need to fetch all the dates which can be done using record.getSublistValue which requires a set of parameters which you can find here. Once you have filtered out the date, you can set it on body field using record.setValue and you can find its documentation here.
To get the record, it depends on which script-type you are working on, like if you are sripting in User-Event, you will receive newRecord in its script parameter. Whereas if you are working on some scheduled/map-reduce script, you might have to load the record using record.load from N/record module.
You can also do this in the UI without SuiteScript.
Create a saved search with results as Term Start Date with a summary of Minimum.
Add any criteria that you may need (such as Term Start Date is not empty)
Add a filter of Internal Id.
Create the custom field, and under Validation and Defaulting select the previously created saved search. Make sure that stored value is checked off for the custom field!
Look into the article "Creating Custom Fields with Values Derived from Summary Search Results" in the help center for more information!

Getting the latest value of the item in a column and displaying that value into other list, without using code

I want to get the highlighted value, that is the latest value of the "Availed" from the list shown above, and display it on the second list's "Availed" column, circled below:
Basically, what I am trying to do is, whenever a new item is created in the second list, it fetches the latest value of the "Availed" from the first list and displays in its "Availed" column.
I have tried couple of lookups with IDs and dates using SharePoint designer 2013, but every time I am getting the first entry.
The only way, I could achieve this was, by mentioning the exact item ID in the lookup, but I do not want that. I want that it should automatically pick the latest value when a new item is created in the second list.
Also, there are couple of solutions online using the code, but I am not that great at coding and want to achieve this feature without coding.
Is there a way we can do this without a code?
You could create a workflow for second list, in your workflow, call REST api by 'Call HTTP Web Service' action, Sample here.
Use rest api to get the latest value by $orderby, demo here.

Sharepoint 2010 - Dynamically add new fields in edit or new forms

I'm looking to get some guidance with Sharepoint 2010. I am working on a project which requires a system that would inform concerned users of an outages with their applciation and provide regular updates via email (worflow).
I can accomplish most of the tasks with a simple custom list and workflow. Users would be able to input their start/end time of the outage, description and their update. With a workflow an email would be sent to the concerned users with all the details.
Where the problem starts is that, we have to provide hourly updates on an outage. So I would need to be able to add new update fields dynamically for every new updates and then be able to send all the updates via an email workflow.
At the moment I am just trying to figure out the best way to go about this. I tought that a simple custom list would be sufficient but looks like ill need to create a more complex system. Perhaps ill need to create 3 custom lists, 1 master list that would gather the details from list 1 (cotnains the description, start/end time) and the list 2 (contains updates) and some how link the together.
Would anyone have any advice about this?
I would create 2 lists: 1 main with all details and another one with updates and added multi lookup field to the first list.
OR even better -
added lookup field to the second list and when item is created - set lookup to the item in the list 1. Then you would be able to get all items from the list 2 (updates) by the item in the list 1.
Hope it makes sense.
Regards,
Andrey.
I would consider having following 4 fields apart from whatever you need right now.
1. Update
2. Outage (choice yes/no)
3. Previous updates (hide it on Edit form)
4. latest update hidden (hide this on edit form)
I would use one list. Let the workflow run whenever a new item is created or an existing item is updated.
For new Outage items send the outage email.
For updates:
Every hour check for update on the item
If there is any update then copy the value to latest update and previous updates. Clear the value of update column.
Send email with latest update value.
Once outage is over user updates the update field and makes outage over to yes.
At this point of time the workflow is complete.

SharePoint Nintex Workflow Run Multiple Conditions

I was hoping you could help me. I have a calendar in SharePoint 2010 that I want to run a Nintex Workflow when the following conditions are true:
A new item is created
The "Type of Leave" field equals "Vacation". This field I created as just a category for the types of requests.
The date that the item was created for already has an entry with the "Type of Leave" field equaling "Vacation."
The use of this will be that the first person to enter vacation on a day will be automatically granted. But if more than one person enters vacation on the day that another vacation day is on, it will go through an approval process through their manager.
Here's what I've tried/reviewed:
- Using a Condition within a workflow. I can't find an option that would complete this.
- I did try looking on line searching for different solutions. I've watched some tutorials but nothing with this kind of solution was present.
- One thought I did have was to have an additional calculated column that counted how many entries for the same day with "Vacation" and then use that in a condition if the column was greater than 1 but I couldn't figure out the syntax.
This is on SharePoint 2010.
Thank you!
have you considered using the rest interface to query the list from nintex:
http://msdn.microsoft.com/en-us/library/office/ff521587(v=office.14).aspx
You can call this service from nintext using the call web service action.
Apply the filters on the url as per documentation above and count the records returned you can then include that in the nintext condition.
I am not sure if Nintext supports calls to Restfull services (from memory i think it does).
If not, you can use the Soap web service, same principle as above just the parameters to call it are slightly more complicated:
http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx
I don't think there's an need for REST. Once your workflow starts, query the list for items matching the current item booking date and put the result in a collection. You can query the collection length, and if it's >0 you can use that condition to steer the logic of your workflow.

Resources