I am trying to create a retrievemultiple plugin on the activitypointer entity to filter out all Email activities where duration = 999 days. See code below
if (objQueryExpression1.EntityName == "activitypointer")
{
FilterExpression activityFilter = new FilterExpression(LogicalOperator.And)
{
Conditions =
{
new ConditionExpression("actualdurationminutes", ConditionOperator.NotEqual, 1438560)
}
};
//objQueryExpression1.Criteria.AddCondition(new ConditionExpression("actualdurationminutes", ConditionOperator.NotEqual, 1438560));
objQueryExpression1.Criteria.AddFilter(activityFilter);
}
context.InputParameters["Query"] = objQueryExpression1;
when I register the plugin on retrievemultiple of activitypointer entity, the plugin works fine in 'Advanced Find' mode and in the 'Social Tab' of the related 'Application' entity. However, if I go to the 'Activity Associated View' of the 'Application Entity', it shows me all the activities (including activities with duration=999 days).
Similarly, if I go to the contact record (Applicant on the Application), it shows me all activities (including activities with duration=999 days).
Not sure why the retrievemultiple is working in some instance and not in the other.
This won’t work because CRM uses Rollup message instead of RetrieveMultiple in this case.
Rollup message is not available to register in PRT as such.
However there is unsupported way to expose this Rollup message in PRT.
Related
Because of an error which is now fixed, our customers did not received order confirmation emails for a while.
Is there a way to resent the order emails for some orders once?
We know about the plugin, but as this is supposed be needed only once, it's kind of overkill to install, test and deploy a plugin.
Are there some code snippets or a bin/console command to accomplish this task?
Or is it even possible via the admin panel?
It is possible to define a flowbuilder flow to send order confirmation mails, but you'd to define an appropriate trigger action of course, that you can trigger yourself for the affected orders. After the oneshot command you could disable/delete the flow.
Not sure if this fits your needs...
You could write your own CLI command to re-fire the event when an order is placed.
// $this->orderRepostitory - DI service `order.repository`
// $this->orderConverter - DI service `Shopware\Core\Checkout\Cart\Order\OrderConverter`
// $this->eventDispatcher - DI service `event_dispatcher`
$criteria = new Criteria();
$criteria
->addAssociation('orderCustomer.customer')
->addAssociation('orderCustomer.salutation')
->addAssociation('deliveries.shippingMethod')
->addAssociation('deliveries.shippingOrderAddress.country')
->addAssociation('deliveries.shippingOrderAddress.countryState')
->addAssociation('transactions.paymentMethod')
->addAssociation('lineItems.cover')
->addAssociation('currency')
->addAssociation('addresses.country')
->addAssociation('addresses.countryState')
->getAssociation('transactions')->addSorting(new FieldSorting('createdAt'));
// add a filter for the orders for which no mail has been sent before
$criteria->addFilter(new RangeFilter('createdAt', [RangeFilter::LTE => (new \DateTime('2020-01-01'))->format(\DATE_ATOM)]));
$orderEntities = $this->orderRepository->search($criteria, $context->getContext())->getEntities();
foreach ($orderEntities as $orderEntity) {
$salesChannelContext = $this->orderConverter->assembleSalesChannelContext($orderEntity, Context::createDefaultContext());
$event = new CheckoutOrderPlacedEvent(
$salesChannelContext->getContext(),
$orderEntity,
$salesChannelContext->getSalesChannel()->getId()
);
$this->eventDispatcher->dispatch($event);
}
This should in theory also trigger the mails to be sent once more. Obviously try this with a test order before mass dispatching events like this. Also you should probably do this in smaller batches to avoid memory issues.
I am using the REST api for executing rules on Decision Server (Redhat Decision Manager 7.2) using a stateless kie session. I'm currently getting the number of triggered rules, but I also want to get the names of those rules. Is this possible?
KieServicesConfiguration conf = KieServicesFactory.newRestConfiguration(URL, USER, PASSWORD);
List<GenericCommand<?>> commands = new ArrayList<GenericCommand<?>>();
commands.add((GenericCommand<?>)
KieServices.Factory.get().getCommands().newInsert(applicant, "applicant"));
commands.add((GenericCommand<?>)
KieServices.Factory.get().getCommands().newInsert(loan, "loan"));
commands.add((GenericCommand<?>)KieServices.Factory.get().getCommands().newFireAllRules("numberOfFiredRules"));
KieCommands kieCommands = KieServices.Factory.get().getCommands();
BatchExecutionCommand batchCommand = kieCommands.newBatchExecution(commands, "default-stateless-ksession");
ServiceResponse<ExecutionResults> executeResponse = ruleServicesClient
.executeCommandsWithResults("loan-application_1.2.0", batchCommand);
System.out.println("Number of fired rules:" executeResponse.getResult().getValue("numberOfFiredRules"));
You have to use an AgendaEventListener to keep track of rules exectioned. By implemnting org.kie.api.event.rule.AgendaEventListener interface you can capture these detials.
To know which rules are triggered I added an action column with custom code (Action BRL fragment) that writes the rule name in one of the field of my fact. You can get it from rule.name.
Example:myFact.logMyRuleName(rule.name)
I am working in a project using JPA, and Bean Validation. I want to show friendly messages to the user about the validations that failed, and I need to show these messages in different languages based on the Locale of the users.
I am using standard annotations like #NotNull, #Size, as well as some custom class level validations.
I am using the following code to validate the entities before persist them:
Validator validator = validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<Company>> constraintViolations = validator.validate(company);
if (constraintViolations.size() > 0) {
Set<String> violationMessages = new HashSet<String>();
for (ConstraintViolation<Company> constraintViolation : constraintViolations) {
violationMessages.add(constraintViolation.getPropertyPath() + ": " + constraintViolation.getMessage());
}
}
If validation failed I can see the messages and the fields that failed validation, but I don't know how to convert these validation messages to friendly ones and in different languages (based on the Locale of the users).
I have the following questions:
What is the proper way to achieve this?
I know that JPA checks automatically the entities against validations before persist. If I execute the validation manually (with the above code) am I running the validation process twice?
If I am using JSF which also executes validations before update the model, I am running the validation process three times (1. JSF, 2. the above code and 3. Wildfly/JPA before persist/merge)?
If the above code runs in an EJB, how can I pass the validation errors to the presentation layer (JSF for example)?
Do I need to return a list of ConstraintViolations to the presentation layer? - Do I need to create an exception for each validation?
Thank you
I am looking for a way to use Graph API's for syncing calendar events. Example different types of meeting requests such as "Case Events(court cases) meetings, corporate meetings , persons meetings. For this case in particular he would like to get an event notification when If someone tried to delete a "Case Event Meeting" and prevent the delete.
We have a Java application that adds the different type of meeting requests to the calendar and all of those have an event origin of {f19d3c30-0660-4f7f-96df-6dc78a686633}
The follow code works fine for a changeType of Created, Accepted
"subscriptionConfiguration": {
"changeType": "Created,Accepted,Deleted",
"notificationUrl": "https://xxxxx/listen",
"resource": "me/events/?$filter=singleValueExtendedProperties/any(ep: ep/id eq 'String {XXYY1231-0660-5ty5-96df-6brca687744} Name event_origin' and ep/value eq null)",
.... },
The code above returns nothing in the case of changeType = delete
The only reason they are using the "singleValueExtendedProperties" filter only because they want to filter out only calls created from there java application and act upon them. It works fine for "changeType": "Created,Accepted", but Deleted it returns nothing as the filter seems to remove them.
Is there another way we could filter out the requests that would not require the use the "singleValueExtendedProperties" filter?
Can we think of other options to that would be better than the workaround above?
While you should be able to get notified about the delete, both sync and notifications are "after the fact", so there would be no way to prevent the delete. The closest you could get is to recreate the event which would of course require you to have an offline copy of the event so you could recreate it.
We are using Snaplogic to load records into workday. Currently, extracting customer records from the source and trying to load them into workday using the object Put_Customer of web service Revenue_Management.
I was getting the following error:
But I'm not getting any category information from the source. So, I tried putting the value for Customer_Category_Reference as 1. But I ended up getting the following error.
The documentation for workday is not helpful and this has been a blocker for me for some time now.
Any help will be appreciated.
Update:
Trying to get customer categories using the Get_Customer_Categories object of Revenue_Management web service using Snaplogic. But getting the following error:
Failure: Soap fault, Reason: Processing error occurred. The task submitted is not authorized., Resolution: Address SOAP fault message and retry
Unfortunately I don't have access to a tenant at this time to validate . However it is likely to work based in prior experience . Perhaps you could create a customer in Workday, through the GUI. Then do get customer API call. Note the category reference . Then, use that in your put customer call
If you look at the API documentation, you will find that Put_Customer accepts a WID in the Customer_WWS_Data object. If you search for "Customer Categories" in Workday, you will likely find the report of the same name. Just select the category that you want your newly loaded customers to default to (click on the magnifying class, then on the ellipsis, Integration Ids, View Ids). The Workday ID will appear at the top.
I have not used the Revenue Management API, but my code for creating a position reference in the Compensation API is probably very similar to what you need to do for the Customer Category reference:
public static Position_ElementObjectType getPositionReference(string WID) {
return new Position_ElementObjectType {
ID = new Position_ElementObjectIDType[] {
new Position_ElementObjectIDType {
type = "WID",
Value = WID
}
}
};
}