I'm trying to create a new entity and have it appear in the 'My Finances' and 'Personal Assets' areas.
I am able to create the entity without problems using CreateEntityRequest.
If I create the entity manually I get a list of the variuos areas where I can display the entity.
How can I do the same thing programmatically?
Thanks,
David
You'd have to manipulate the SiteMap to do that; that's not something that's done in the metadata of the entity itself.
I was able do get this to work using the Microsoft.Crm.Sdk.IsvReadiness.SupportingItems.SiteMap class that comes with the SDK in conjunction with ExportXmlRequest and ImportXmlRequest.
Thanks,
David
Related
I am using LINQ to talk to Dynamics CRM. I have found the DbFunctions class in the docs. But when I go to the definition it has NO methods. I want the DateDiffYear method, but I can find no samples online and it simply does not appear to be present in the reflected code?
OK, the docs are USELESS. You need to install EntityFrameworkCore.SqlServer for this to appear.
Thanks for being my rubber duck again, Stack Overflow!!!!
I've been tasked with creating a workflow in Dynamics 365 which can send emails (the easy bit). However, the email has a link to the record (also easy using the Record URL(Dynamic) attribute). However, we use Apps in our Dynamics instance and the link generated by the workflow using Record URL(Dynamic) doesn't include the app id and so when users click the link they are taken to Dynamics but are now outside the app.
My question is, is there a supported way to appending the App Id to the Record URL(Dynamic) attribute?
I've already searched for answers to this and cant find any. My solution was to create an Action which takes as input the Record and app ID, appends them and outputs them as an output parameter. This works to be honest, but I'm wondering if I'm reinventing the wheel and there is an easier way to achieve this.
Thanks and hope this helps anyone else with the same issue.
We can get the Application ID from Xrm.Utility.getGlobalContext();
The application ID is one of the properties that returned
var globalContext = Xrm.Utility.getGlobalContext();
globalContext.getCurrentAppProperties().then(
function success(app) { console.log(app.appId); }, function errorCallback() { console.log("Error"); });
For more details refer to Here
While we are waiting for MS to give the OOB option to choose Model driven app Id & embed in Record url of WF, I recommend you to follow Andrew Butenko’s workaround using Ultimate Workflow Toolkit to achieve it with no code.
This is basically using UWT custom step to append App Id with Record url on the fly.
I want to add some attributes to the user entity, when I googled about it, I found a similar question :
How to modify existing entity generated with jhipster?
when I followed the steps in this post, I couldn't find the file user.json anywhere as #Roberto montioned
1) Edit the json file representing your entity (add/remove field, the syntax is pretty easy, check in the end of the file if is required any change to the general entity properties like 'fieldsContainOneToMany'...), you'll find it in:
<jhipster_root_folder>/.jhipster/entityName.json
How can I solve this ?
I think the best solution is a compromise between the two solutions offered by #Pedro and #alcuvi (who references to the JHipster Documentation):
First, create an "ExtendedUser" entity with the additional fields (don't forget to use git, you will have to undo this/delete the entity). A one-to-one relationship to "User" is not necessary.
After that, you can copy many parts from "ExtendedUser" to the other parts of the JHipster Application:
Liquibase changelog columns (also add them to users.csv)
ExtendedUser.java → User.java and UserDTO.java
extendedUser-dialog.* → register.html/.controller.js and settings.html/.controller.js
Adapt AccountResource.java and UserService.java (and UnitTests if you use them). This step is mostly done by using getters and setters copied in the step before. JHipster Documentation (https://jhipster.github.io/tips/022_tip_registering_user_with_additional_information.html) might be helpful here.
Delete the "ExtendedUser" Entity (using git, or manually, see also: How to delete an entity after creating it using jhipster?)
The *advantages* are:
Using JHipster code generation capabilities
No additional entity (which comes with new DB tables and many files)
I hope this information will help other developers in the future!
The User entity is the entity used by JHipster to manage all user management stuff, like email, passwords, etc., so you won't find a User.json file, since that is an automatically generated entity. Those .json files are only created when you run yo jhipster:entity <entityName>.
In order to add/remove fields to the User entity, you'll have to do it manually, that means editing User.java, creating a liquibase changeset and modify all related files in the UI as needed.
The official documentation of jhipster (version 4) have an entry about this.
https://jhipster.github.io/tips/022_tip_registering_user_with_additional_information.html
In summary...
Its manual solution.
The proposed solution is to create an entity with the fields you want to add to user and linked to it with a one to one relationship.
Alternatively
If you create a ExtendedUser with new fields with JDL-Studio the jhipsterimport-jdl command is going to create "extendedUser" option on entity menu where you can set values for those fields and linked to the user you want.
I thinks is not the best solution...
What about inheritance? Just extend built-in User class with new fields. For example, public class ExtendedUser extends User. And replace User class with ExtendedUser in code. Update dto, service, etc. Also you can use class casting where it's required. What thoughts?
How would you suggest working with files that is stored on the note of a entity in Crm. Could you write a generic method that will enable you to access any type of file? Or would it be better to have a method for dealing with each type of file?
For example, we are going to be saving a mix of swf files and xml files on the entity, so would it make sense to have a method each for example:
GetXmlFilesOnAccount(accountid)
GetSwfFilesOnAccount(accountid)
When you upload an attachment to CRM the mimetype is also saved as part of the record information.
The following link contains a nice example of how to download the attachemt using a single method. http://crmscape.blogspot.com/2009/10/ms-crm-40-sending-attachments-to.html
The post is missing the actual query needed to retrieve the annotations but you can tell what columns are required from the method signature.
My suggestion using your methods:
* GetXmlFilesOnAccount(accountid)
* GetSwfFilesOnAccount(accountid)
Retrieve account activitypointers by regardingobjectid(in your case accountid guid)
Loop through returned activitypointers
Get attachments for each activitypointer (activitypointer.activityid = activitymimeattachment.activityid)
Store attachments (disk, etc)
You don't even need two methods. You can retrieve all attachment file types for a given note (annotation) with a single method.
Hope this helps.
I recently started an Open Source Project on CodePlex to accomplish exactly that. Feel free to check out the Project's Web Page at:
http://crmattachdownload.codeplex.com/
You can also view the source code under the "Source Code" tab of that same page.
Pete
I have created a custom entity in MS CRM 4.0 and am trying to update a couple of the attributes via a custom worflow in .Net. I have read through several of the forums and blog posts and am still confused on how to access the custom entity and update some of their attributes.
I created a custom entity to replace how CRM was doing allotments as our company has some specific business rules that CRM wasn't doing. When a task is completed on an incident I want to update an attribute in the custom entity with the task duration. Any help would be greatly appreciated.
Thanks
When using the CRM web service in a custom workflow, you'll need to use DynamicEntity objects. The workflow context webservice is just an ICrmService so it doesn't know about your specific customizations. There's a pretty sample here: http://www.stunnware.com/crm2/topic.aspx?id=CustomWorkflowActivity
I imagine you could also add the CRM web services as a web reference to your workflow project. Then you'd have strongly types objects for your custom entities. I've never done this for my custom workflows, but it works for other custom apps accessing CRM.
Choosing Dynamic Entities over WSDL in favour is always the better choice.
When you develop a piece of code, you are more flexible with your classes. You could use your piece of software in different contexts for different systems. That's the reason Dynamic Entities were invented.
It's very easy and you dont'have to use DynamicEntity. You have to go to Settings -> Customization -> Download WSDL. Take the wsdl and use it in your project. Now you have all your custom entities strongly typed. All you have to do is to write something like this:
Guid entityId = getEntityId();
new_yourCustomEntity entity = new new_yourCustomEntity();
entity.new_yourCustomEntityid = entityId;
entity.new_customProperty = "value";
CrmService crmService = new CrmService();
crmService.Update(entity);
Maybe what you really mean is Custom Workflow Activity? This involves writing your own .NET class to add functionality to the standard CRM WF in form of new step types. If what you want to do is just to update an attribute you don't really need this, even if it is on a custom entity. The Update record step does just this and allows dynamic values (coming from other entities) to be specified.
Hope it helps
Daniel