How to trigger Javascript in CRM VIew Refreshing? - dynamics-crm-2011

I create one javascript function For calculate the No.Of Days from created Date and show in one Field.
And I add that script in Form Load and as well Form Save Actions.It was Working Fine.
Now My question is,I need to trigger that javascript function grid's(view) refresh.Or I need to calculate and show the No Of Days Field without opening Form.
Now the noofdays field affected when the form will getting open.
I need noofdays field automatically updated From the Created on date?How to do this...Thanks in Advance

Trigger an javaScript function without opening the from is not possible.
If i understood correctly, you want to display the time period between the creation and current date in days.
If so:
A Solution would be:
On creation of the record the noofdays field will always be 1 or 0. However you look at it.
So you can fill that field on creation per default to 1 per Plugin, JS, or simply per workflow.
Now you need to update this field each day via workflow.
The workflow must retrieve all records, calcualte and update the noofdays field.
I reccomend to run this workflow after midnight.
The other solution: (I do not reccomend)
Create an Plugin which is registerd to the message "retrieve" and "retrieve multiple".
If the message is triggered, check if you are in the right entity and fake the output of the noofdays field or update it.

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.

Is their a way to set value for all existing records using Acumatica code without modifying the screen

User requirement is to create duplicate customer field in Invoice screen and that custom field is using for some historical data, But by default we are passing current Invoice customer value and later we are allowing user to change the custom field.
so in this case is there a way to set the value for existing records through code with out refreshing/modifying the existing record.
I have tried by using field level PXDefault attribute but that will not work in my case so their any events or some code to update custom field value for existing fields.
Thanks in advance.
I believe PXDefault would only execute when a new Row is being inserted. Perhaps one option could be to explicitly call cache.SetDefaultExt(e.Row) if value is null, but I am not sure whether it is 'legal' to do it on a row Selected
One other possibility is to use Generic Inquiry Mass Update (https://asiablog.acumatica.com/2016/09/mass-processing-using-gi.html). This way to could perhaps update past records in bulk. But be careful of Acumatica Transaction License limits.

Netsuite - mass update a field from a calculated field

I have a custom field "views calculated" on an inventory item that is a calculated value. I cannot sort by calculated values so I need that value moved into a static field via a mass update. So once a day I want "views calculated" to move its value into "views"
I submitted a support case. I had to do it via a workflow based on another saved search. So you can do it and it is a suiteAnswer. I didn't catch the number or I'd post it here. As a side note: Be careful testing scheduled workflows in testing mode. It only processes the top 20 records. I spent a day troubleshooting before I figured that out. That nugget is suiteAnswer id 36738 "Testing Scheduled Workflows"

Remove a button in SuiteScript

I need to be able to remove the delete button when today is greater than a particular calculated date.
There are 2 ideas I had and issues with each:
1 - Set a custom field on the record for the particular calculated date. Then use a workflow action of Remove Button where the custom field is <= today. My issue is I am wondering if there is a way to get "today" because I expected the condition to change allowing me to do that. I tried to use a formula and can't find Now() as a valid function listed.
2 - Workflow are truly scripts in the background. That means the Remove Button should be available in API. Therefore, my idea was to do my conditioning in suite script and then call this function. However, this function also does not exist in supported form. Has anyone hacked this to find what the function that is called in Remove Button is?
If we can get either idea to work, or if you have a third I haven't thought of that accomplishes the same task, that would be great.
I figured out my own answer. In case someone else ever needs this (as I didn't see anything like this on stack overflow), here is how to do option #1:
Save the value to a custom field - custbody_block_dlt_date
In a workflow, use the Remove Button function and use a formula condition
The condition is: {custbody_block_dlt_date} < sysdate
"sysdate" is the way you can get "Now()" or "today" in the condition
An alternative could be to create a User Event Script, on the before load function, get the button object then use the .setVisible(visible) method to hide it based on a date criteria, you may also want to set other restrictions based on roles that allow certain individuals to still be able to delete the record, like high positioned accountants. That avoids creating unnecessary fields on your records, while still providing the functionality that you desire. This could easily be done in < 4 lines of JavaScript.
See nlobjButton for examples.

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.

Resources