On the Activities tab of the Contacts screen, I am pulling activity data from an outside source and creating corresponding Acumatica activities. This activity creation is a periodically schedule process, so the activities are not created real-time. Therefore the CreatedDateTime field for the external activities does not reflect the actual time that the activities happened.
However, I need these external activities to be sorted according to when they actually occurred (not according to when they were created in Acuamtica) and to be displayed in proper sequence relative to existing Acuamtica activities. But the Activities view for the Contacts graph is sorted by CreatedDateTime, so these activities are being displayed according to Acuamtica creation time not their actual time.
I can think of two possible solutions, but I cannot see a way to accomplish either one.
1. Set the CRActivity.CreatedDateTime field to be the actual activity time.
If we could set the Created Date Time to be the actual time of the activity, the default sort order for the Activities tab would correctly display the external activities in sequence of when they actually occurred. However, this field is a default system field, and I do not see a good way to force it to be anything other than the time the Acumatica object is persisted. Is there any way to specify a value for the CreatedDateTime field?
2. Modify the default sort order of the Activities tab.
We can set the StartDate of the new activities to be the actual time that they occurred. So if we could order the Activities grid by Start Date rather than by Created Date Time, that would also achieve the desired affect. If the Activities view were a straightforward PXSelect, we could simply create a new PXSelect statement with the order by we want in our graph extension and use that as the data member for the grid. However, the Activities view is not simple and the OrderBy is buried inside the GenerateOriginalCommand method of the CRActivityListBase class. Is there anyway to override this OrderBy in way that takes advantage of all the functionality of CRActivityListBase?
Is there an acceptable way to use either of these approaches, or is there an alternative approach that would display the activities sorted by actual time?
You can replace Sorting utilizing OrderByNew as below.
public class ContactMaintPXExt : PXGraphExtension<ContactMaint>
{
public override void Initialize()
{
Base.Activities.OrderByNew<OrderBy<Desc<CRActivity.startDate>>>();
}
}
Related
I would like to change the price of a product based on the customer's selection. For example, I'm trying to build a small PDP widget to make customers able to choose the number of candles on a cake or write text on cakes and update the price accordingly. The docs only cover how to change the price by overwriting the cart's collector/processor but I don't want to use this method because of other plugins potentially overwriting the same service. So, is there are any other methods of changing the price of the products by subscribing to an event?
There are a few things you will need to consider in this one.
Firstly, you will need to save the user input data somewhere (amount of candles, text).
Possibly a separate database table that has a OneToMany relationship on cart line items. See this article. Und ya, this is also the part where you will hook into the onLineItemAdd event & save your user input to that table. You may as well also subscribe to the onLineItemUpdate for the same saving logic. You could do the same when removing the item from the cart, although that may not be necessary if you use database's "CASCADE on delete" when implementing your DB table. Meaning once the line item gets removed by the customer (deleted in the DB), your database entry gets deleted as well.
Afterwards, you can then use the extensions or otherwise called associations to pull this data on the cart page & the order pages. You can be a little more fancy here, if you look at all the frontend router calls, you will notice that Shopware sometimes passes "Criteria" class you can hook into.
public static function getSubscribedEvents(): array
{
return [
OrderRouteRequestEvent::class => 'alterCriteria',
DocumentOrderCriteriaEvent::class => 'alterCriteria',
];
}
public function alterCriteria(Event $event): void
{
if (method_exists($event, 'getCriteria')) {
$event->getCriteria()->addAssociation('lineItems.myExtension'); // check syntax, could be lineItem.
}
}
Now you can extend the twig templates to show your candles or text in the order page, cart page, document (invoice) pages.
Secondly, you will have to handle the price. This part will be easier now that you have data saved & being automatically pulled via criteria subscribers. If it's not possible to hook into those events all the time, you will still have an option to manually load your data.
I do not recommend modifying the price itself, but maybe you could look into adding a surcharge instead. Maybe this article will be helpful to understand the price flow. You could also see if there are any other plugins out there that implement surcharge logic to see it in action.
I'm working with a client on obtaining Bills and Adjustments values through the Contract based web services. I understand that certain fields aren't available in the Default Endpoint, and have to be obtained through an extension.
I'm trying to add fields from the Bills and Adjustments' Applications tab, but I'm running into a warning that I don't understand. If I extend the Default endpoint for 'Bills' (call it 'BillExt'), and I try to add the Reference Number field from the 'Applications' tab/grid (or any other field from that grid) - I get the following warning (see screenshot below)...
Can someone explain what the issue is, and how I go about adding these fields from the 'Applictaions' tab/grid? I've added fields from the 'Approval Details' grid without this warning without a problem. Is this a warning I can disregard?
You are trying to add a field from another table/view that can return multiple rows for a single Bill.
The correct way to do this is by adding a separate collection on the object and map the view on that collection. e.g: Applications or Details collections here.
That collection will have the information for all records related to the header once you retrieve them using the ?$expand=Details on the query string request.
we created a custom screen which displays list of sales data based on filter conditions like (today, yesterday, this week, this month, this quarter, this year), we created a SQL view for this and then from VIEW we created and DAC and using it in custom screen. We also have filters in our screen. for filter conditions we are using view delegate and returning the data. the question is why the screen takes too long around 70 seconds to load 2K records. Is using view delegate decrease the speed of loading data. We can go with GI but we need to display images in the GRID so we opted for custom screen and also we have some report button in header which prints report. as we can't show images in GI we chose this.
The slowness you see is most likely caused by combination of two reasons.
When you use BQL view, it in fact requests only the number of records you see on the screen. For instance if you have grid with paging and only 20 records are visible on the page, the SQL select will have TOP 20 limitation. However, once you have select delegate, that optimization stops working since the framework does not know what you'd like to do with the data you select. The solution here would be to use SelectWithViewContext with DelegateResult return object instead of regular select. In that case user filtering, pagination and ordering is preserved in the select. (Use this method only if resulting records on the screen relate as 1 to 1 to the records you select. If you use any kind of aggregation or inserting records from 2 different select, that approach does not work)
Example:
protected virtual IEnumerable ardocumentlist()
{
PXSelectBase<BalancedARDocument> cmd =
new PXSelectJoinGroupBy<BalancedARDocument,
...
OrderBy<Asc<BalancedARDocument.docType, //Set necessary sorting fields: use the key fields
Asc<BalancedARDocument.refNbr>>>> //Set necessary sorting fields: use the key fields
(this);
PXDelegateResult delegResult = new PXDelegateResult
{
IsResultFiltered = true, //set these fields to indicate that the result does not need re-filtering, resorting and re-paging
IsResultTruncated = true,
IsResultSorted = true
}
foreach (PXResult<BalancedARDocument> res_record in cmd.SelectWithViewContext())
{
// add the code to process res_record
delegResult.Add(res_record);
}
return delegResult;
}
Probably you don't have proper indexes on your table since even if you select all 2k records at once it should not result in 70 seconds load time. Recommendation here would be to use the request profiler to catch the exact SQL generated (https://help-2020r2.acumatica.com/Help?ScreenId=ShowWiki&pageid=e4c450bb-86bc-4fb2-b7e6-1f715abe3c8b) and execute the SQL in MS SQL Management studio with option 'Include Actual Execution Plan' (https://learn.microsoft.com/en-us/sql/relational-databases/performance/display-an-actual-execution-plan?view=sql-server-ver15) . Usually in this mode the MS SQL server suggests the indexes needed to speed up the query execution.
I have connected excel with AzureDevOps, as explained by microsoft
https://learn.microsoft.com/en-us/azure/devops/boards/backlogs/office/bulk-add-modify-work-items-excel?view=azure-devops
Is it any way possible to export the Parent Work ID in the same row in excel as the actual work item that I am exporting?
What I want to achieve is to sum all remaining work that is left on feature level. This means I need to summarize the remaining work for all tasks under all users stories that belong to this feature.
I could fix this by adding tag of the parent feature in all tasks, but I want a better way.
There can be only one parent. Is there any way to export the parent ID?
Thank you.
Excel can`t import an id of linked work item in the same row. In your case, work items have to contain a parent ID in separate field. I see two ways to resolve your issue:
Create a new field for parent work item types (e.g. summary work). Then with custom solution fill that field with sum of child work.
Create a new field for the child work item types (e.g. parent id). Then with custom solution copy into that field a parent work item id.
Additionally, to avoid customization of your process template you can use Power BI custom reports (Analyze and report on your work using the new VSTS analytics service : Build 2018).
Using excel for analyzing the AzureDevOps work did not really work for all use cases.
The main reason was the ParentId. But basic graphs its easy to do.
Since then I have started using PowerBI instead. And I have managed to achieve all my requirements. After the initial setup its very straightforward to build custom reports in PowerBI.
Azure DevOps has introduced a new feature to make the Parent column available in queries.
Add parent field to backlog and queries
"The parent field is now available when viewing backlogs and query results. To add the parent field, use the Column options view."
I am attempting to pass information from a task created within a workflow to its corresponding task form. Prior to the CreateTask activity, I create an SPWorkflowTaskProperties and fill it with the usual info (title, assigned-to, etc). I also add some elements to the ExtendedProperties property. However, those custom properties never make it into the Task.
I've tried setting the property key to:
the Guid of one of my task' content
type's fields;
the internal name of
one of my task' content type's
fields;
an unrelated name (in the
hopes of getting the info into the
task's properties instead of its
fields).
Nothing works. The task, once created, contains only the built-in field values I have set. None of values I explicitly added to the extended properties show up.
The (simplified) sequence of my activities is as follows:
PrepareTask. This is a custom
activity that contains the
SPWorkflowTaskProperties
CreateTask. The task properties are bound to the one in the PrepareTask activity.
OnTaskCreated. The task properties are bound to the one in the PrepareTask activity.
While (task not complete)
OnTaskChanged
I am using WSS 3.0 SP1 and an ASPX (NOT InfoPath) task form.
I still don't know why my original solution didn't work. But I have found a workaround. My sequence of activities is now:
CreateTask
OnTaskCreated
CopyTaskItems. This is a custom
activity that puts values into my
custom task's fields, then updates
the task.
While (task not complete)
OnTaskChanged
So I have to create the task, then immediately poke values into it and update.
I hope this will help some future reader of this question.
You should be using a ItemMetadata.xml document as a secondary datasource that contains the definition of the fields that you want to pass to your task form. Something like:
<z:row xmlns:z="#RowsetSchema"
ows_Instructions=""
ows_Body=""
ows_Comments=""
ows_ApprovalStatus=""
/>
The File name is important btw.
Notice the ows_ (as it used the webservices all fields in the list will be prefixed with ows.)
Then in you infopath form, set the default value of each control you want to display this information in. Hit the fx button and insert a field or group from the secondary datasource.
A good resource: http://weblog.vb-tech.com/nick/archive/2007/02/25/2207.aspx