Revit 2020 API - Family Document active view returning null after Family document is open and activated - revit-api

I'm trying to get the active view of my family's document but it returns null. In Revit 2019, it would always return a value however I've recently switched to Revit 2020 and it seems to be giving me an issue.
Has anyone else run into this yet and come across a solution?
I've stumbled across this post but its recommendation is to use a filtered element collector which I am not a fan of. I'm having issues passing it to other classes. Revit 2019 seemed so simple.
Note: this also persists in Revit 2021
Here's a picture of my debug showing its null
and then here's a picture of my Snoop for the family document after it is open and activated showing it has a value.

The reason behind this is that you are currently working on a project document, which means the project document is open and 1 of its view is showing in Revit graphical view, not the family document. Therefore, the View from the family document is not showing - A.K.A no active view for the family document.
The solution you are looking for is explained in this post:
switch view or document by showing elements
In short, you create an UIDocument from family document, then use the newly created UIDocument to show the family document via:
UIDocument.ShowElements()
After that, you have an active view for your family document.

Related

SharePoint 2013 TaxonomyFieldType in custom list has IsTermSetValid = False

I'm using Visual Studio 2012 to create a custom Site Column of type TaxonomyFieldType, a custom content type that uses it, and a custom list that uses the content type.
Everything appears to deploy fine. If I look at my custom site column it appears to reference the proper termset correctly. I can create a new list in the web UI that uses my custom content type just fine. However, my custom list created using the Visual Studio 2012 List template always shows my taxonomy field as disabled on the new form. Here are the other things I've witnessed about it:
In the web UI of SharePoint, if I go to the list properties and drill into my taxonomy site column I notice it shows that it isn't mapped to a termset. Keep in mind that if I do the same thing in Site Settings for my content type it appears correct. I can do the same thing for the web UI created custom list and everything is fine (editable in the new form and the field has the termset defined).
If I use powershell to dump out the info for the site column itself it has a valid termset.
If I use powershell to dump out the info for the field in the VS2012 created list it shows emtpy guid for the SspId, TermSetId, and TextField. It also shows IsTermSetValid = False.
If I use powershell to dump out the info for the field in the SharePoint web UI created list it shows the correct guid for the SspId, TermSetId, and TextField. It also shows IsTermSetValid = True.
Does anyone know why I seem to be having this behavior for the VS 2012 create custom list? Any help is appreciated.
Okay, so I'm going to answer my own question. Hopefully this will help someone else in the future.
My issue was that when creating a sample list for my content type (described in original question post), using the SharePoint UI, the needed Note field was getting added. Even if I had this right in my original TaxonomyFieldType declaration, I would have also ran into issues with my field values not showing up in the search refiners later on when I got to that part. Thankfully Ari Bakker has written a very detail explanation of what all you need to do in order to create your custom TaxonomyFieldType derived field, a custom content type to use it, a list definition, and a list instance. Just follow the details in the article: http://www.sharepointconfig.com/2011/03/the-complete-guide-to-provisioning-sharepoint-2010-managed-metadata-fields/

In CRM 2011, using javascript, how can I get the calling entity or form type name?

In CRM 2011, using JavaScript, how can I get the calling entity or form type name? For example, if I open an activity, I want to see if I opened this activity from an account form or a contact form etc. I have googled this and I am not finding anything.
In that particular case you should check the regarding field - CRM automatically populates this, that should contain the information you require.
Use
window.parent.opener.Xrm.Page.data.entity.getEntityName()
This will only work if you have opened up the entity from the calling entities' form.
It will not work if you open up the entity from the related activities section by on the left.
Basically the parent page should have the entity form loaded in order to use the Xrm.Page.data object.

Unable to auto assign Document properties from Document Set shared columns

I have a SharePoint document library I am working on. It has a list of document sets. Each document set has a few fields that are marked as "Shared" so that they can be inherited by the documents inside.
When I upload a document inside a form opens and all the fields on the form are pre-filled with the shared values of the corresponding columns. But when I use create document from template, it opens the template in the corresponding Office application but the document property fields are empty and not read-only which is against the requirements of this project. I require them to be synced and filled exactly like when a document is uploaded.
There is one thing though. The user can fill any value he wants in those fields and they will still be saved a synced copy from parent in the library discarding what the user filled in, which is good, but why not show those values up in the document in the first place?
Anyone has experience in handling this please help. I have searched a lot on the internet but either my keywords are wrong or no one has had this problem before.
SharePoint version: 2010 Server
Office version: 2010 Professional
It sounds like you need a simple event reciever, which fire on itemadded. It would then go back up the tree to find the document set. Capture which properties are marked as shared. Adjust the item that is being added to force the values.
Probably 8 lines of code

SharePoint 2010 Update view = reflects on List?

Say you have a list...a document library "TestDoc" and you have a standard view "TestView1" applied to it. You also have the same "TestDoc" on a diferent page ("Page 2") with a standard view "TestView2" applied to it.
Currently, if you make changes to "TestView1" no changes will be made to your "TestDoc"...Likewise, updating "TestView2" will not change "TestDoc" on "Page 2".
How do you attach a view to a list such that updates made to the view will be reflected on the lists that you have that view attached to?
I asked the same question on the Microsoft SharePoint forum and it seems that updating multiple lists upon updating a single view is not possible without tinkering with server-side code.
http://social.technet.microsoft.com/Forums/sharepoint/en-US/d2ecdbff-371b-45a5-8f3c-075bab3c29e5/list-view-auto-update-carryover

SharePoint Discussion Board "Last updated" field is not updated any more

On of our SharePoint users informed me today about a strange behavior of a discussion board on one of his sites.
Normally the standard "subject" view of an discussion list has a field named "Last updated" showing the date and time of the last post within the corresponding thread. On the discussion board of our user this field is never set to the date/time of the last post but stays on the date/time when the thread was started.
The site on which the discussion board is located was created from a custom web site template which includes the empty discussion board.
To narrow this problem I created a second discussion board on the same site, with the result that it sets the Last updated field correctly.
Any suggestions why the Last updated field doesn't update any more?
Has the view been modified to use the creation date instead? I've had more than a few problems with people accidentally modifying the shared view of a list instead of the personal view...
We've experienced the same behavior. No solution, but the Last Modified field seems to do the same.

Resources